Skip to content

Instantly share code, notes, and snippets.

@Aricg
Last active December 16, 2015 21:09
Show Gist options
  • Select an option

  • Save Aricg/5497208 to your computer and use it in GitHub Desktop.

Select an option

Save Aricg/5497208 to your computer and use it in GitHub Desktop.
Personal reference next time I use awk for other than print $x field
Gondrol
2321
56
58
45
RinRao
2122
38
37
65
Edwin
2537
78
67
45
Dayan
2415
30
47
20
Jones
2143
78
84
77
root@aricdebian6:~/Gitted# awk '{FS="\n"; RS="\n\n"; }NR=="6"{ print $0 "\n""fields:",NF,"record:",NR }NR=="5"{ print $1,$2,$3 "\n""fields:",NF,"record:",NR }' Student.txt
Dayan 2415 30
fields: 5 record: 5
Jones
2143
78
84
77
fields: 5 record: 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment