From wc manual page - "A word is defined as a string of characters delimited by white space characters."
This is where sed is comes to rescue.
ruch:coding ruchi$ cat poem.csv
twinkle,twinkle,little
star,how,I, wonder
what,you, are.
ruch:coding ruchi$ cat poem.csv | wc -w
5
ruch:coding ruchi$ sed 's/,/ /g' poem.csv | wc -w
10
ruch:coding ruchi$
No comments:
Post a Comment