pastebin - collaborative debugging tool
blankb.kpaste.net RSS


awk field separators
Posted by Anonymous on Fri 15th Jun 2018 01:48
raw | new post

  1. awk -F '[,\t]' '{printf("one:%s two:%s three:%s\n",$0,$1,$2);}'
  2.  
  3. echo "1,2|3:4,5" | awk 'BEGIN{FS="[|,:]"}{printf("zero:%s one:%s two:%s three:%s four:%s five:%s \n",$0,$1,$2,$3,$4,$5);}'
  4.  
  5. zero:1,2|3:4,5 one:1 two:2 three:3 four:4 five:5

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}





All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at