Results 1 to 2 of 2
I want to take user specified columns from two files and join them into one file.
I store column input from the user into columns1.txt and columns2.txt. I use sed ...
- 11-02-2008 #1Just Joined!
- Join Date
- Nov 2008
- Posts
- 2
Help with script....awk
I want to take user specified columns from two files and join them into one file.
I store column input from the user into columns1.txt and columns2.txt. I use sed to convert input from "5 6 7" to "$5$6$7"
I want to use awk for getting the columns...exBut of course using columns1.txt doesn't work. So how do I take whats inside the file and use it to express inside awk for the columns I want?Code:awk ' {print columns1.txt }' file1
If there is a better way about doing the whole thing, I'm all open for suggestions.
- 11-03-2008 #2Linux Newbie
- Join Date
- Jul 2008
- Posts
- 181
Assuming columns1.txt contains something like "5 6 7", try something like this:
Code:cut -f $(sed 's/ \+/,/g' columns1.txt) file1


Reply With Quote