Appending 1st field in a file into 2nd field in another file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Appending 1st field in a file into 2nd field in another file
# 1  
Old 12-25-2010
Appending 1st field in a file into 2nd field in another file

Hi,

I've internally searched through forums for about 2+ hours. Unfortunately, with no luck. Although I've found some cases close to mine below, but didn't help so much.

Actually, I'm in short with time. So I had to post my case. Hoping that you can help.

I have 2 files,

FILE1

23444,
12333,
55578,

FILE2
8
9
8

I want to

(a) append the filed in FILE2, into 2nf field of FILE1:

23444, 8
12333, 9
55578, 8

and in other run

(b) append the filed in FILE2, into FILE1 as follows:

23444,8
12333,9
55578,8

In ADDITION & generally, can you provide me with a solution that:
extracts the "Nth" field from FILE1 into the "Mth" filed in FILE2?

Waiting for your input, with my appreciation in advance.

BR,
Ahmed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to replace last field in a file,if first field matches

Hi, Need to replace last field in a file(/etc/passwd) ,if first filed matches with particular username. Scenario: cat testfor1 deekshi:x:7082:7082::/home/deekshi:/bin/bash harini1:x:7083:7083::/home/harini1:/bin/bash Here,if first field contains "deekshi", then i should replace... (4 Replies)
Discussion started by: Sumanthsv
4 Replies

2. UNIX for Dummies Questions & Answers

Combine Similar Output from the 2nd field w.r.t 1st Field

Hi, For example: I have: HostA,XYZ HostB,XYZ HostC,ABC I would like the output to be: HostA,HostB: XYZ HostC:ABC How can I achieve this? So far what I though of is: (1 Reply)
Discussion started by: alvinoo
1 Replies

3. Shell Programming and Scripting

Command/script to match a field and print the next field of each line in a file.

Hello, I have a text file in the below format: Source Destination State Lag Status CQA02W2K12pl:D:\CAQA ... (10 Replies)
Discussion started by: pocodot
10 Replies

4. Linux

How do I format a Date field of a .CSV file with multiple commas in a string field?

I have a .CSV file (file.csv) whose data are all enclosed in double quotes. Sample format of the file is as below: column1,column2,column3,column4,column5,column6, column7, Column8, Column9, Column10 "12","B000QRIGJ4","4432","string with quotes, and with a comma, and colon: in... (3 Replies)
Discussion started by: dhruuv369
3 Replies

5. Shell Programming and Scripting

Appending information from 2nd file into 1st based on intervals

Hi, I am trying to gather information from the second file and append it to the first file. input HWUSI-EAS000_29:1:100:10000:11479#0/1 + chr5 14458050 ATTGGCTGAGGTCCTACTAGTTGTGATGTGTAAGTGT HHHHHHGDGGEDGGGDGCGEDDEFFFAGE 0 second file:... (14 Replies)
Discussion started by: Diya123
14 Replies

6. Shell Programming and Scripting

Plz Help. Compare 2 files field by field and get the output in another file.

Hi Freinds, I have 2 files . one is source.txt and second one is target.txt. I want to keep source.txt as baseline and compare target.txt. please find the data in 2 files and Expected output. Source.txt 1|HYD|NAG|TRA|34.5|1234 2|CHE|ESW|DES|36.5|134 3|BAN|MEH|TRA|33.5|234... (5 Replies)
Discussion started by: i150371485
5 Replies

7. Shell Programming and Scripting

Compare two files Field by field and output the result in another file

Hi Friends, Need Help. I have file1.txt as File1.txt |123|A|7267|Hyder|Cross|Sell|7801 |995|A|7051|2008|Lunar|New|Year|Promotion|7801 |996|A|7022|Q108|Targ|Prospect|&|SSCC|Savings|Promo|7801 |997|A|7182|Q1|Feb-Apr|08|Credit|ITA|PA|SBA|Campaign|7801 File2.txt... (7 Replies)
Discussion started by: i150371485
7 Replies

8. Shell Programming and Scripting

Append 1st field from a file into 2nd field of another file

Hi, I've internally searched through forums for about 2+ hours. Unfortunately, with no luck. Although I've found some cases close to mine below, but didn't help so much. Actually, I'm in short with time. So I had to post my case. Hoping that you can help. I have 2 files, FILE1 ... (1 Reply)
Discussion started by: amurib
1 Replies

9. Shell Programming and Scripting

Appending a new field at the end in a file

can anyone tell me please ......how to append a new field at the end of a file with the help of sed or some other command in bourne shell (8 Replies)
Discussion started by: amitpta
8 Replies

10. Shell Programming and Scripting

Sort alpha on 1st field, numerical on 2nd field (sci notation)

I want to sort alphabetically on the first field and sort in descending numerical order on the 2nd field. With a normal "sort -r -n" it does this: abc ||| 5e-05 ||| bla abc ||| 3 ||| ble def ||| 1 ||| abc def ||| 0.2 ||| def As you can see it ignores the fact that 5e-05 is actually 0.00005... (1 Reply)
Discussion started by: FrancoisCN
1 Replies
Login or Register to Ask a Question
mhc(5)								File Formats Manual							    mhc(5)

NAME
mhc - Message Harmonized Calendaring system DESCRIPTION
This manual page documents briefly the mhc file format. This manual page was written for the Debian GNU/Linux distribution because the original program does not have a manual page. FIELDS
Mhc file format is based on STD11/RFC822: Standard for the format of ARPA Internet text messages. In mhc file, the following extra header fields are used. X-SC-Day: Date of event in format yyyymmdd. You can specify multiple date with space separated like: X-SC-Day: 19990409 19990413 which means April 9th 1999 and April 13th 1999. X-SC-Time: Time of event in format hh:mm-hh:mm or hh:mm. For event which has no meanings about time, you can leave it empty in this field. X-SC-Duration: Period of event in yyyymmdd-yyyymmdd. You can omit start date or end date, like "19991121-". X-SC-Duration: is used only to limit date specified by X-SC-Day: or X-SC-Cond, so you can't describe event date only by X-SC-Duration:. If X-SC-Duration: is empty, it means no limit. X-SC-Cond: Condition of event date by using following keyword. 00-31 Day of month. 1st 2nd 3rd 4th 5th Last Week in month. Sun Mon ... Sat Day of week. Jan Feb ... Dec Month Examples, X-SC-Cond: Tue Fri Every Tuesday and Friday. X-SC-Cond: 31 Aug Every August 31th. X-SC-Cond: 1st 3rd Fri Every 1st and 3rd Friday. X-SC-Cond: Fri X-SC-Day: !19990409 Every Friday, but except April 9th 1999. X-SC-Cond: Fri 13 Every 13th and Every Friday, not 13th Friday. X-SC-Alarm: Hint for alarm of event. Currently, mhc.el doesn't alaram, but gemcal will pop-up alarm window. It will be useful if you transfer this event to PalmOS. In X-SC-Alarm:, you can specify the number (1 to 99) with suffix such as minute, hour or day. For example, X-SC-Alarm: 10 minutes Alarm 10 minutes before event. X-SC-Alarm: 3 hour Alarm 3 hours before event. X-SC-Alarm: 3 day Alarm 3 day before event. X-SC-Subject: Subject of event. unstructured? X-SC-Location: Location of event. unstructured? X-SC-Category Category of event. Any keyword, space separeated. Case ignored. X-SC-Recoard-Id: Internal use only. SEE ALSO
adb2mhc(1) gemcal(1), mhc-sync(1), mhc2palm(1), palm2mhc(1), today(1). AUTHOR
This program was written by Yoshinari Nomura <nom@quickhack.net> and this manual page was written by Fumitoshi UKAI <ukai@debian.or.jp>, for the Debian GNU/Linux system (but may be used by others). 23 Jun 2000 mhc(5)