command Flashcards

(5 cards)

1
Q

print first column of command delimited

A

awk -F”,” ‘{print $1}’ file1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

omit first line, afterward print entire line

A

awk ‘NR!=1{print $0}’ file1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

set a field separator and pass a value

A

awk ‘{print $0,val}’ OFS=, val=$x file1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

comma delimited, 1st column only exactly matches Rent or Medicine, print entire line

A

awk -F, ‘$1 ~ /^Rent$|^Medicine$/’ file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

comma delimited, print matching Medicine and 2nd column greater than 500

A

awk -F, ‘/Medicine/ && $2>500’ file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly