Insert a column from 1 file into a 2nd file
Hi, I'm trying to copy a column from one file and insert it into another file
e.g. file1 col1 col2 col3 col4 col5 col6 col7 col8...coln file2 col1 col2 col3 col4 col5 col6 col7 col8...coln-1 How do I copy col6 from file1 and insert it between col5 & col6 of file2? Both files have the same number of rows and the identifiers in col for both files match. Is there a solution for this? |
Have a look at awk as it is able to grab a column and place it anywhere you like.
|
Is this something you need to do repeatedly, using a program or script, or just a once-or-twice thing that you could do with a text editor? If the former, then you probably want to look at a scripting language such as AWK or Perl, or possibly even Bash with a little help from sed. Give one of those a shot, and when you bump into problems, post your work here, and someone will be able to guide you.
If you just need to to a one-time copy & paste, then many plain-text editors can do column/block oriented copy & paste. I use nedit for my daily text editing, and it does a good job of manipulating columns of text. --- rod. |
Thanks. I'll have a look to see what awk options are available and hopefully be able to construct the correct command.
|
All times are GMT -5. The time now is 11:13 AM. |