Manipulate the columns of 2 files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Manipulate the columns of 2 files
# 1  
Old 01-07-2015
IBM Manipulate the columns of 2 files

Hello,

I have two files to be treated.
First file:
Code:
col1 col2 col3 col4

Second file:
Code:
colbis

- I try to add the unique column of the file 2 towards the file 1.
- To obtain the following result with a shell script ksh:

Code:
col1 col2 col3 col4 colbis

Thank you for your help
# 2  
Old 01-07-2015
Any ideas/attempts from your side?
# 3  
Old 01-07-2015
IBM

I don't know how to malipulate 2 files with awk.
I don't know where to start Smilie
# 4  
Old 01-07-2015
No need for awk. For single line files as posted, try
Code:
cat file[12] | xargs
col1 col2 col3 col4 colbis

For multiline files try

Code:
paste -d" " file[12]
col1 col2 col3 col4 colbis


Last edited by RudiC; 01-07-2015 at 04:54 AM..
This User Gave Thanks to RudiC For This Post:
# 5  
Old 01-07-2015
Thanks a lot
I also find the command pasteSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Manipulate files with find and fuser not working as expected on SunOs

Greetings, For housekeeping, I use the following command: find /some/path -type f -name "*log*" ! -exec fuser -s "{}" 2>/dev/null \; -exec ls -lh {} \; It finds all log files not currently in use by a process and manipulates them. This command always works on linux and redhat machines,... (2 Replies)
Discussion started by: dampio
2 Replies

2. Shell Programming and Scripting

Help - manipulate data by columns and repeated

Hello good afternoon to everyone. I'm new to the forum and would like to request your help in handling data. I hope my English is clear. I have a file (Dato01.txt) to contine the following structure. # Col1 - Col2 - Col3 - Col4 Patricia started Jun 22 05:22:58 Carolina started Jun... (5 Replies)
Discussion started by: kelevra
5 Replies

3. UNIX for Advanced & Expert Users

Shell script to manipulate files

My requirement is explained below: list of files available in server 1 in path /home/xxx/src are: XX_SRC_20130417.txt XX_SRC_20130417.dat $cat XX_SRC_20130417.txt col1=ABC col2= col3=xyza sequence file name is maintained which is in the path /ab_app/xx/seq $cd /ab_app/xx/seq$cat... (0 Replies)
Discussion started by: vedanta
0 Replies

4. UNIX for Dummies Questions & Answers

Writing a for loop to manipulate multiple files

Hi, I have 1000 text files in a folder that are labeled data1.txt all the way to data1000.txt. I want to write a small script that manipulates the text files in this way: (1) cut the 2nd and 9th columns of the text files (2) sort by the numerical value in the 9th column (3) then save the rows... (3 Replies)
Discussion started by: evelibertine
3 Replies

5. UNIX for Dummies Questions & Answers

Manipulate and move columns in a file

Hello Unix Gurus, I have a request 2 perform several functions on a file, delete columns, delete rows based on column value, and finally move around columns in the final output. Consider the following input file with 12 columns; ... (1 Reply)
Discussion started by: chumsky
1 Replies

6. Shell Programming and Scripting

Manipulate columns using sed

Hello, I would like to remove the first column of lines beginning by a character (in my case is an open square bracket) and finishing by a space (or any other delimiter). For example: string1 string2 string3 to string2 string3 I found this previous topic: ... (1 Reply)
Discussion started by: stoyanova
1 Replies

7. UNIX for Dummies Questions & Answers

using sed to manipulate text in files

Hi, I have a slight problem in trying to manipulate the text within a file using the "sed" command in that the text i need changed has "/" slashes in. I have a .sh script that scans the "/db/sybbackup/" directories for any .dmp file older than 2 days and then to >> the information to a file called... (3 Replies)
Discussion started by: Jefferson333
3 Replies

8. Shell Programming and Scripting

Manipulate files

Hi everybody: I have a problem. I have a output files which have this pattern: number1 --space block1a - 7rows/10columns/65elements --space block1b - 7rows/10columns/65elements --space block1c - 7rows/10columns/65elements --space number2 --space block2a - 7rows/10columns/65elements... (0 Replies)
Discussion started by: tonet
0 Replies

9. Filesystems, Disks and Memory

manipulate csv file to add columns

Hi, I have a csv file with a key composed by 3 columns and some other numeric fields and I need to obtain the partial amounts by some part of the key. This may be some difficult to understand, so better see an example, where my input file is: name,surname,department,y2004,y2005,y2006... (6 Replies)
Discussion started by: oscarmon
6 Replies
Login or Register to Ask a Question