Append string to columns from 2 files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Append string to columns from 2 files
# 1  
Old 04-28-2008
Append string to columns from 2 files

Hi

Having a file as follows
file1.txt
Code:
Date (dd/mm)Time      Server        IP                       Error Code
===========================================================================
10/04/2008   10:10     ServerA    xxx.xxx.xxx.xxx             6	
10/04/2008   10:10     ServerB    xxx.xxx.xxx.xxx             9	
10/04/2008   10:10     ServerC    xxx.xxx.xxx.xxx             16	
10/04/2008   10:10     ServerD    xxx.xxx.xxx.xxx             60

File2.txt
Code:
  Status 
=============
Solved
Pending
Outage
Process

Need to update file1.txt as below
Code:
Date (dd/mm)Time      Server        IP                       Error Code            Status
================================================================================================================
10/04/2008   10:10     ServerA    xxx.xxx.xxx.xxx             6	            Solved
10/04/2008   10:10     ServerB    xxx.xxx.xxx.xxx             9	            Pending
10/04/2008   10:10     ServerC    xxx.xxx.xxx.xxx             16	     Outage
10/04/2008   10:10     ServerD    xxx.xxx.xxx.xxx             60             Process

is there anyway to append columns using awk or sed

thanks in advance
# 2  
Old 04-28-2008
Refer man paste...
# 3  
Old 04-28-2008
thanks to all

solved with the below simple arguments

paste file1 file2 > file2
# 4  
Old 04-28-2008
sorry typo mistake

paste file1 file2 > file3
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Append string to all the files inside a directory excluding subdirectories and .zip files

Hii, Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories. Eg. file1: test1.log file2: test2.log file3 test.zip After running the script file1: string_test1.log file2: string_test2.log file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies

2. Shell Programming and Scripting

Unzip all the files with subdirectories present and append a part of string from the main .zip files

Hi frnds, My requirement is I have a zip file with name say eg: test_ABC_UH_ccde2a_awdeaea_20150422.zip within that there are subdirectories on each directory we again have .zip files and in that we have files like mama20150422.gz and so on. Iam in need of a bash script so that it unzips... (0 Replies)
Discussion started by: Ravi Kishore
0 Replies

3. UNIX for Advanced & Expert Users

Help in adding a string at the end of each line and append files vertically

hi, i need a help in the script , need to append a string at the end of each line of a files , and append the files into a single file vertically. eg file1 has the following columns abc,def,aaa aaa,aa,aaa files 2 has the following rows and columns abc,def,aaa aaa,aa,aaa i... (3 Replies)
Discussion started by: senkerth
3 Replies

4. Shell Programming and Scripting

Compare columns of multiple files and print those unique string from File1 in an output file.

Hi, I have multiple files that each contain one column of strings: File1: 123abc 456def 789ghi File2: 123abc 456def 891jkl File3: 234mno 123abc 456def In total I have 25 of these type of file. (5 Replies)
Discussion started by: owwow14
5 Replies

5. UNIX for Dummies Questions & Answers

Append a string on the next line after a pattern string is found

Right now, my code is: s/Secondary Ins./Secondary Ins.\ 1/g It's adding a 1 as soon as it finds Secondary Ins. Primary Ins.: MEDICARE B DMERC Secondary Ins. 1: CONTINENTAL LIFE INS What I really want to achieve is having a 1 added on the next line that contain "Secondary Ins." It... (4 Replies)
Discussion started by: newbeee
4 Replies

6. Shell Programming and Scripting

Using columns from 2 files and extracting string

Hi All, I have 2 files with a common column. File 1 looks like NAME START POS1 POS2 N1 1234 1236 1237 N2 1245 1248 1250 .. .. File 2 looks like NAME STRING N1 ABCDEFGH N2 EFGHBCD N3 PQRSSTUV .. ...... ... (25 Replies)
Discussion started by: alpesh
25 Replies

7. Shell Programming and Scripting

Need to append columns for every run

Hi, I have a requirement where I need to append the runtimes of the jobs for every run. I have some 100 jobname and it will be static in output(1st column) . Everyday I need to run my script to find the runtimes for that day and add the entire 100 runtimes to the right of those 100 jobs(2nd... (19 Replies)
Discussion started by: ajayakunuri
19 Replies

8. Shell Programming and Scripting

question about append columns

I like to do the following, please help! Thanks a lot for f in seq(f1 f2 f3 g1 h1 t2) do cut -d "+" -f2 $f > $f.nums paste ? # each loop will attach additional column to the created file $f.nums, how to do this??? done (1 Reply)
Discussion started by: ksgreen
1 Replies

9. Programming

Compare two files of 4 columns and o/p unique,append zero's

I have to files File1 1 23 2 34 3 7 4 56 5 61 6 22 7 65 File2 2 21 4 32 7 22 Now i need to compare column1 of both the files and generate a third file which should contain all the values of 1st column of 1st file and in the second column i need to get the coressponding row... (2 Replies)
Discussion started by: kamuju
2 Replies

10. UNIX for Dummies Questions & Answers

append files as columns

Hi, I will rephrase my question. I have two files: q16 1.341E+05 wf8 3.084E+02 total1 1.344E+05 ud35 5.694E+03 us38 9.367E+05 ya23r 9.414E+02 up23s 2.403E+04 io240 1.203E+04 q16 1.341E+05 wf8 3.084E+02 total1 1.344E+05 ud35 5.694E+03 us38 9.367E+05 (2 Replies)
Discussion started by: f_o_555
2 Replies
Login or Register to Ask a Question