Ngô Thị Vân
New member
How do you print the first and last line in Unix?
Answer
sed -n ‘1p;$p’ file.
txt
will print 1st and last line of file. txt . After this, you’ll have an array ary with first field (i.e., with index 0 ) being the first line of file , and its last field being the last line of file .
Answer
sed -n ‘1p;$p’ file.
txt
will print 1st and last line of file. txt . After this, you’ll have an array ary with first field (i.e., with index 0 ) being the first line of file , and its last field being the last line of file .