I need to convert a file i.e
cat list
1000:
1001:
1002:
to
cat wrappedfile 1000:1001:1002:
currently I am using a while loop, paste and mv command to achieve desired outcome.
touch wrappedfile
cat list | while read line ;do echo $line > /tmp/$line;paste /tmp/$line wrappedfile > wrappedfile.tmp;mv wrappedfile.tmp wrappedfile;done > out
cat out
1000: 1001: 1002:
Then to clean it up I pipe it to sed 's/:./:/g' to remove spaces between each #
1000:1001:1002:
It doesn't seem very efficient to me.
Maybe awk or sed or perl has an option or utility to quickly and cleanly get the result I am looking for.
The numbers represent Netbackup (6.5) media that I was to eject using the multi_eject option offered in vmchange command.
vmchange -res -multi_eject -w -verbose -rn 0 -rt tld -rh acuransx -vh acuransx -ml $ejectfile
$ejectfile is variable derived from the output i.e. 1000:1001:1002:
Forgot about tr, use to use it to change lowercase to uppercase a long time ago.
thanks
That still leaves me with a sed command to clean it up. You have definitely reduced the work load by eliminating the while loop.
I did a man on tr and still had a hard time figuring out how your syntax is working in this instance. Could you explain? "\n" " "
can it be used by redirecting output rather than redirecting out from a file as in your example to redirecting output from a script.
script produces one column of output
or does the output from script have to be redirected to a file and then passed to tr?