1
00:00:00,990 --> 00:00:05,020
So now what's great some really simple script with a for loop.

2
00:00:05,310 --> 00:00:19,330
So great file in for that as I age and start with siobhán then bash and on next line we can write some

3
00:00:19,330 --> 00:00:20,040
command.

4
00:00:20,080 --> 00:00:21,270
We are building.

5
00:00:21,400 --> 00:00:28,670
So into all text files in the current directory.

6
00:00:31,370 --> 00:00:36,150
And you line the cut and

7
00:00:40,960 --> 00:00:51,630
and first five lines of a second.

8
00:00:51,720 --> 00:00:57,610
So one time or into all text files in the current directory of a new line with the current date and

9
00:00:57,610 --> 00:01:01,510
the first five lines of B-S common.

10
00:01:01,650 --> 00:01:04,550
So now we can create for a loop.

11
00:01:05,430 --> 00:01:16,550
So for a file in elist which is represented by a wildcard asterisk dot text and just for the recap in

12
00:01:16,550 --> 00:01:20,670
wildcard it's asterisk means any number of characters.

13
00:01:20,690 --> 00:01:23,060
So for each text file we need two plays.

14
00:01:23,060 --> 00:01:30,650
Now some commands between do and done keyboards we can start with printing the current date but because

15
00:01:30,650 --> 00:01:37,810
date is a command we need to command substitution and wrap it inside parentheses and then the output

16
00:01:38,000 --> 00:01:46,810
when we need to read it to textfile represented by variable file added action is done using greater

17
00:01:46,810 --> 00:01:47,750
than symbol.

18
00:01:47,750 --> 00:01:55,550
But there is good to mention that Sinko great that dense himbo would rewrite content of a file by our

19
00:01:55,610 --> 00:02:05,590
output and we want to own at your output to a file we need to use double grade den symbol.

20
00:02:06,130 --> 00:02:12,740
Now redirect five lines of B-S command and to specify first five lines.

21
00:02:12,740 --> 00:02:15,140
I am using head Desch 5

22
00:02:18,200 --> 00:02:20,400
and it is basically done

23
00:02:25,220 --> 00:02:35,870
but for better readability I will print a few equal signs into next command and also read it next to

24
00:02:35,870 --> 00:02:39,240
a file.

25
00:02:39,450 --> 00:02:41,190
Now you can save the file

26
00:02:44,410 --> 00:02:45,940
Grant with permission

27
00:02:49,880 --> 00:03:01,050
and I can check using ls command that I don't have any text files here so I will create files on both

28
00:03:01,250 --> 00:03:04,740
text files to the text.

29
00:03:05,720 --> 00:03:10,060
And also I can create file sutee without any extensions.

30
00:03:12,050 --> 00:03:17,800
Now we can then descript and check out of file one.

31
00:03:24,700 --> 00:03:25,560
Great.

32
00:03:25,690 --> 00:03:31,560
Date and five lines from commom for being sure that the script is working fine.

33
00:03:31,570 --> 00:03:33,200
I can check for three

34
00:03:36,310 --> 00:03:38,260
and can see that it is empty.

35
00:03:38,260 --> 00:03:39,610
Great.

36
00:03:39,850 --> 00:03:42,200
Now we can nondescript again.

37
00:03:42,850 --> 00:03:45,060
And if we check files to for example

38
00:03:49,550 --> 00:03:52,080
we see two outputs added here.

39
00:03:52,180 --> 00:03:53,120
Great.
