![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| merge text files | panchpan | AIX | 4 | 12-11-2008 08:34 AM |
| How to Merge Two .xls files side by side into a single .xls | jagadish99 | Shell Programming and Scripting | 2 | 09-24-2008 07:44 AM |
| How to Merge Two .xls files side by side into a single .xls | jagadish99 | Shell Programming and Scripting | 0 | 08-27-2008 07:38 AM |
| How to print two sql query outputs side by side in excel | prasee | Shell Programming and Scripting | 6 | 09-08-2007 03:20 AM |
| Having a Unix system installed side to side with Windows? | Pcslider | UNIX for Dummies Questions & Answers | 14 | 01-29-2002 06:21 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Merge 2 text files to one text file side by side
Inquiring minds want to know.... I need to take two files that I have latitude and longitude values and then combine them into one file with the values side by side separated by a space.
the first file is temp113-lat.txt and the second is temp113-lon.txt. They each have values listed in the file like the example below <temp113-lat.txt> 2644.989500 2645.791200 2647.358600 2647.358300 2647.338700 2647.307900 2647.312100 2647.240400 2647.000300 2646.618800 2646.472100 2646.358800 <temp113-lon.txt> 5104.146495 5103.428400 5103.305700 5103.446300 5103.442100 5103.538900 5103.875200 5104.080100 5105.286800 5105.493300 5105.901000 5106.284000 I want to take these and post them into a .txt file in the following format. <113latlon.txt> 2644.989500 5104.146495 2645.791200 5103.428400 .... .... I am trying to write a script to do this automatically but I am missing the line with the command string to do this function. I have tried to use the "paste" command and for some reason it will not output the correct format I want. anyone want to jump in on this one for me... I am at my limit. |
|
||||
|
That is what I thought. I am not really understanding what the problem is... I did that exact command and this is what I got
[77225 loc]$ paste -d' ' temp113-lat.txt temp113-lon.txt 5105.471900 5105.626300 5104.146495 5104.146495 5104.146495 5103.428400 5103.305700 This is only one of the files and it seperated at the beginning by a space. Why would it only be pulling the data from one file? I checked both files and they contain data. Could it be due to the fact there is a process to get these files? I am including the process in the script. grep m_lat /113/*.log > /loc/temp113lat.txt grep m_lon /113/*.log > /loc/temp113lon.txt grep m_lat /114/*.log > /loc/temp114lat.txt grep m_lon /114/*.log > /loc/temp114lon.txt cd /loc awk '{print $3}' temp113lat.txt > temp113-lat.txt awk '{print $3}' temp113lon.txt > temp113-lon.txt awk '{print $3}' temp114lat.txt > temp114-lat.txt awk '{print $3}' temp114lon.txt > temp114-lon.txt The next line would be the process to combine the files into one text file so the other program can read them. Any thoughts? |
![]() |
| Bookmarks |
| Tags |
| text processing |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|