dollin
1
I've got a file that looks like: -
001
abcde
002
fghij
003
klmno
004 ......
and i want to use a sed command that will change the file to look like: -
001 abcde
002 fghij
003 klmno
004 ......
i've tried things like s/00\n//g but they don't seem to work. Any ideas?
Thanks,
tomapam
2
hi,
maybe that can help :
$ more my_script
#!/usr/bin/ksh
cat $1 | while read LINE
do
case $LINE in
*[0-9])
echo $LINE>>/home/number
;;
*)
echo $LINE>>/home/alpha
;;
esac
done
sdiff /home/number /home/alpha | sed s/\|// > /home/ result
$ ./myscript your_file
$ more result
001 abcde
002 fghij
003 klmno
004 ......
is this helping?
A truly sed-only solution:
#! /usr/bin/sed -f
#
# this script will join every other line
N ;# suck in a second line
s/\n/ / ;# change new-line to space
or a more conventional script:
#! /usr/bin/ksh
sed -e 'N;s/\n/ /'
exit 0