Requirement: Only grep/cut/join/cat/regex/for/while.
I am a beginner at shell utilities.
I have fileA and fileB containing equal number of rows. I want to append columns of fileB into fileA.
I am trying this (cat fileA && cat fileB) > fileC
. But it isn't working as required.
Expected:
fileA:
1
2
3
fileB:
1
2
3
then fileC should have:
1 1
2 2
3 3
With bash:
#!/bin/bash
while true; do
read -r f1 <&3 || break
read -r f2 <&4 || break
echo "$f1 $f2"
done 3<fileA 4<fileB >fileC
Output to fileC:
1 1 2 2 3 3