
03-17-2009
|
|
Shell programmer, author
|
|
|
Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
|
|
Quote:
Originally Posted by narang.mohit
hey i m newbie i dont know whether this is happining in my terminal or is there any reason behind this
here it is
when i do
1.) sed -n 's/\t/\n/gp' space > enter #where space is tab seperated file
it works fine it give me a outupt that all tab seperated convert into column
but when i tried to reverse this it wount work
2.) sed -n 's/\n/\t/gp' enter > space
|
There can be no newline inside a line read from a file.
Quote:
it wouldnt give me any output
i know there is an alternative for this
3.) cat enter | tr "\n" "\t"
|
No need for cat:
Code:
tr "\n" "\t" < enter
Or:
Code:
awk '{ printf "%s\t", $0 }' enter
|