There’s more than one way to do it — linux
| -UncategorizedThe original problem:
Hi, I have a file in this format of words: joe jill bill bob frank tom harry and want to convert the file to this format: joe jill bill bob frank tom harry Is there an easy way to this? The file I have has hundreds of entries. Thanks Mike
Several proposed solutions
for word in `cat file`; do; echo $word; done > new_file for x in `cat file`; do echo $x; done sed -ri 's/[ \t]+/\n/g' file tr ' ' '\012' < infile > outfile fmt -w 1 filename > newfile perl -p040 -l12 -e 'chomp' filename perl -p040 -e 's/\s/\n/' filename
You can comment with Disqus or you can e-mail me at sacha@sachachua.com.