Skip to content

awk

yeah, command line utils!

prepend before each line

input:

a
b
c

what you want:

* a
* b
* c

how to achieve this:

cat input | awk '{print "* " $0;}'

get odd and even lines

even:

echo $text | NR%2==0

odd:

echo $text | NR%2==1

cut / skip line

awk 'NR>1' # start after 1st line, use 2, 3 etc.
awk 'NR>1 {print $1}'