I have a program which outputs a pair of words surrounded by spaces on each output line:
aa bb
ccc ddd
ee fff
I would like to reformat those in a bash script to remove the spaces and separate the words with a ‘/’
aa/bb
ccc/ddd
ee/fff`
So far the only way I’ve figured out is two scripts:
script1:
#!/bin/bash
while read line
do
./script2 $line
done
script2:
#!/bin/bash
echo $1/$2
Is there some obvious way to do it in one script that I’m not seeing?
1 Answer