![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
SED again...
hi could u tell me how to use sed for the following issue:
i have 2 files A and B . A has say 100lines: line1 line2 line3 . . . line100 i want to read data from file A and save it in file B as : line1, line2, line3, ... line99, line100 that is in a single line. What is the best way to do this...i thought of using the sed command sed -i '1,$s/$/" parameter "/' fileB but cudnt get how to read the text from fileA and pass it as a paramete to the Sed command? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Jithinravi,
Sorry, my mistake, it is "paste" with the "s": Code:
paste -s - < fileA > fileB Last edited by Shell_Life; 05-14-2007 at 06:31 AM. |
|
#3
|
|||
|
|||
|
nope sorry!! it says pate command not found.
|
|
#4
|
|||
|
|||
|
Code:
tr '\n' ',' < file |
|
#5
|
|||
|
|||
|
Quote:
Code:
sed -n -e :a -e 'N;s/\n/, /;$p;b a' fileA > fileB |
|||
| Google The UNIX and Linux Forums |