blob: 0dd3895f809e2853dae2c05054aa5d079404c111 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#print
You can use all the special characters in the
search commands. For example,
/^cat/p
prints the first line that BEGINS with 'cat'.
You can even leave out the 'p':
/^cat/
does the same thing.
Now go into file 'text' with the editor and
print the first line that ENDS with 'dog'.
Then leave the editor and type 'ready'.
#create text
This is a file which
contains several occurrences
of the word 'dog' in several
places. It would be a doggone
shame if you didn't find
the right dog
to print out.
#copyout
#user
#uncopyout
grep 'dog$' text >X1
grep 'dog' .ocopy >X3
tail -1 X3 >X2
#cmp X1 X2
#log
#next
50.1c 10
50.2c 5
|