Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Test 1
- Test 2
- Test 3
- Test 4
- UNIX
- Test 5
- Test 6
- Test 7
- Test 8
- Test 9
- Test 5
- Test 6
- $ awk '$0 == "UNIX" {i=1;next};i && i++ <= 2' file
- Test 5
- Test 6
- grep -A2 -P '^UNIX$' file
- awk '$0=="UNIX"{getline; print; getline; print}' file
- sed -n '/^UNIX$/{n;p;n;p}' file
- grep -A 2 UNIX file.txt
- -A NUM, --after-context=NUM
- Print NUM lines of trailing context after matching lines.
- Places a line containing -- between contiguous groups of
- matches.
- sed -n '/UNIX/{n;p;n;p}' /path/to/file
- $ for i in {1..9}; do echo $i; done | sed -n '/4/{n;p;n;p}'
- 5
- 6
- ex -s +'1,/UNIX/d|%p|q!' file_or_/dev/stdin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement