This repository was archived by the owner on Jun 5, 2024. It is now read-only.
File tree 1 file changed +20
-20
lines changed
1 file changed +20
-20
lines changed Original file line number Diff line number Diff line change @@ -407,13 +407,13 @@ Consider this sample file, with line numbers prefixed
407
407
408
408
``` bash
409
409
$ cat sample.txt
410
- 1) Hello World!
410
+ 1) Hello World
411
411
2)
412
412
3) Good day
413
- 4) How do you do ?
413
+ 4) How are you
414
414
5)
415
- 6) Just do it
416
- 7) Believe it!
415
+ 6) Just do- it
416
+ 7) Believe it
417
417
8)
418
418
9) Today is sunny
419
419
10) Not a bit funny
@@ -428,8 +428,8 @@ $ cat sample.txt
428
428
429
429
``` bash
430
430
$ tail sample.txt
431
- 6) Just do it
432
- 7) Believe it!
431
+ 6) Just do- it
432
+ 7) Believe it
433
433
8)
434
434
9) Today is sunny
435
435
10) Not a bit funny
@@ -556,13 +556,13 @@ DESCRIPTION
556
556
557
557
``` bash
558
558
$ head sample.txt
559
- 1) Hello World!
559
+ 1) Hello World
560
560
2)
561
561
3) Good day
562
- 4) How do you do ?
562
+ 4) How are you
563
563
5)
564
- 6) Just do it
565
- 7) Believe it!
564
+ 6) Just do- it
565
+ 7) Believe it
566
566
8)
567
567
9) Today is sunny
568
568
10) Not a bit funny
@@ -572,29 +572,29 @@ $ head sample.txt
572
572
573
573
``` bash
574
574
$ head -n3 sample.txt
575
- 1) Hello World!
575
+ 1) Hello World
576
576
2)
577
577
3) Good day
578
578
579
579
$ # some versions of head allow to skip explicit n character
580
580
$ head -4 sample.txt
581
- 1) Hello World!
581
+ 1) Hello World
582
582
2)
583
583
3) Good day
584
- 4) How do you do ?
584
+ 4) How are you
585
585
```
586
586
587
587
* when number is prefixed with ` - ` sign, all lines are fetched except those many lines to end of file
588
588
589
589
``` bash
590
590
$ # except last 9 lines of file
591
591
$ head -n -9 sample.txt
592
- 1) Hello World!
592
+ 1) Hello World
593
593
2)
594
594
3) Good day
595
- 4) How do you do ?
595
+ 4) How are you
596
596
5)
597
- 6) Just do it
597
+ 6) Just do- it
598
598
599
599
$ # except last 2 lines
600
600
$ seq 13 17 | head -n -2
@@ -634,7 +634,7 @@ Warning: something went wrong
634
634
more blah
635
635
636
636
==> sample.txt < ==
637
- 1) Hello World!
637
+ 1) Hello World
638
638
2)
639
639
3) Good day
640
640
@@ -643,7 +643,7 @@ $ head -q -n3 report.log sample.txt
643
643
blah blah
644
644
Warning: something went wrong
645
645
more blah
646
- 1) Hello World!
646
+ 1) Hello World
647
647
2)
648
648
3) Good day
649
649
```
@@ -661,8 +661,8 @@ $ head -n11 sample.txt | tail -n3
661
661
11) No doubt you like it too
662
662
663
663
$ tail sample.txt | head -n2
664
- 6) Just do it
665
- 7) Believe it!
664
+ 6) Just do- it
665
+ 7) Believe it
666
666
```
667
667
668
668
<br >
You can’t perform that action at this time.
0 commit comments