0

Is there a bug in Raspbian join command? I can't get two files to join.

FILE1 left.cut: Level: Reputation: XP: XP to Next Level: Gold: Diamonds: Energy:

FILE2 right.cut: 111 154,955 722,642 911 1,225 0 1,500/1,500

none of the following works: join left.cut right.cut join left.cut right.cut > join.txt join -j left.cut right.cut > join.txt join -1 1 -2 1 -t"_" left.cut right.cut > join.txt

I just want a simple line by line file join: Level: 111 Reputation: 154,955 XP: 722,642 XP to Next Level: 911 Gold: 1,225 Diamonds: 0 Energy: 1,500/1,500

But join just about always errors on line 5 (sometimes on BOTH files), but always with FILE2 first. I have tried changed changing the spaces in FILE1 and the comma's in FILE2, but the error does not change, even if the line does.

I have verified the contents of the files with hexdump -C, that there are no hidden characters interfering.

I have used a "no option join" before with no problems, why is this not working?

1

From the join 'man' page:

For each pair of input lines with identical join fields, write a line to standard output. The default join field is the first, delimited by blanks.

So this will not work for your situation. The command 'paste' should work, though. Try

paste -d ' ' file1.cut file2.cut > join.txt

The -d parameter changes the delimiter from a tab to a space.

0

Thanks for the above (simple) answer.

If you dont have access to paste for what ever reason, the following will work: for I in `seq 1 7`; do J=$(( $I - 1 )) echo "`cat left.cut | head -n $I | tail -n 1` `cat right.cut | head -n $I | tail -n 1`" >> join.txt done

The 7 being the number of lines in each file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.