Parsing file using shell script

vassim1977
vassim1977 used Ask the Experts™
on
Hi  i have the following text file that i need to parse using shell script . What i need is basically
to transform the file to be in format

firstline +space + secondline

//////////////////////////////////// Result text file ////////////////////////////////
US TLS Italian :00
US TLS Spanish :00
US HOSTED :00
..
..
etc

///////////////////////////   Initial text file /////////////////////////////
US TLS Italian
:00
US TLS Spanish
:00
US HOSTED
:00
US HOSTED P1
:00
US INSTALL
:00
US INSTALL P1
:00
US NETWORK
:00
US NETWORK P1
:00
US OS
:00
US OS P1
:00
US OTHER
:00
US OTHER P1
:00
US PLT1
:00
US PSOD
:00
US PSOD P1
:00
US STORAGE
:00
US STORAGE P1
:00
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Run this

sed -e "s/\n\:/\:/g" inputfile > outputfile

In case it doesn't work, you may need \r\n instead of just \n.
Most Valuable Expert 2013
Top Expert 2013
Commented:
Hi,
in case the above "sed" suggestion doesn't work for you, try awk -
awk '{if (NR%2==0) printf "%s\n", $0 ; else printf "%s ", $0}'  inputfile > outputfile
Note - with the above every line with an "even" linenumber (2,4,6) will be joined with its preceeding line. So the input file must be of the format exactly as posted (no header line for example)!
wmp
ozo
Most Valuable Expert 2014
Top Expert 2015

Commented:
paste -s -d ' \n' inputfile > outputfile

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial