Hi all, I am having a very critical problem in merging lines in my file as, let my file contents are:
cat test1.txt
name1.......
address1.......
phone1......
<blank>
name2......
address2.....
phone2.....
<blank>
and so on. Now i have to merge these lines by which my desired output becomes:
name1...... address1..... phone1......
name2..... address2..... phone2.....
I use the commands found in a forum:
cat test1.txt | tr -d '\n' > test2.txt (also tried: sed -e :a -e N -e 's/\n/ /' -e ta test.txt > test2.txt)
and got the result like:
name1........ address1........
phone1.......
<blank>
name2....... address2........
phone2.........
<blank>
When i tried to put single quote(') at the begning and end of each line using command
sed "s/^/'/g; s/$/'/g" test2.txt > test3.txt
it gives output as
'name1...... address1......
phone1......
<blank>
name2...........address2...............
phone2..................
<blank>
'
Problem 1: it consider whole file as single line and put single quotes at the starting of file and at end of file. So how could i sort this problem?
Problem2: How could i get the desired output ?
Please help me guys, this is very urget for me
Thanks in advance