Copy data form File A and Create File B


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Copy data form File A and Create File B
# 1  
Old 07-14-2012
Copy data form File A and Create File B

Code:
File A


I have list of :


ABCND1
ABCND2
ABCnd3
ABCnd4



I want  file B like below

Start+

S Pate=ABCND1 AAlo1
S Pate=ABCND1 Q1234
S Pate=ABCND1,P12345
S Pate=ABCND1 Pwe amr=5
S Pate=ABCND2 AAlo1
S Pate=ABCND2 Q1234
S Pate=ABCND2,P12345
S Pate=ABCND2 Pwe amr=5
S Pate=ABCND3 AAlo1
S Pate=ABCND3 Q1234
S Pate=ABCND3,P12345
S Pate=ABCND3 Pwe amr=5
S Pate=ABCND4 AAlo1
S Pate=ABCND4 Q1234
S Pate=ABCND4,P12345
S Pate=ABCND4 Pwe amr=5

End-

# 2  
Old 07-14-2012
Where does the AAlo1, Q1234, etc come from?
# 3  
Old 07-14-2012
It is fixed.......I want just use file A data .....

Each of File A line have Four Value in File B
# 4  
Old 07-14-2012
Code:
 awk 'BEGIN {print "Start+\n\n"; Arr[0]=" AAlo1"; Arr[1]=" Q1234";Arr[2]=",P12345";Arr[3]=" Pwe amr=5";}
{for (i=0;i<4;i++) {print "S Pate="$0""Arr[i];}} END {print "\n\n End-";}' FileA > FileB

This User Gave Thanks to PikK45 For This Post:
# 5  
Old 07-14-2012
Thanks man ....If i have more then 4 line in File A.....What i should...do

Ex..

Code:
File A 


ABCND1
ABCND2
ABCnd3
ABCnd4
ABCnd5
GHDDd5
GHDDd4
....

Just like that ...More then 4....
# 6  
Old 07-14-2012
According to the one-liner, the FileA contents are dynamic. But the
Code:
 AAlo1
 Q1234
,P12345
 Pwe amr=5

this increases you may need to add them to the array Smilie
This User Gave Thanks to PikK45 For This Post:
# 7  
Old 07-14-2012
Perfect Sir......Thanks a lot

---------- Post updated at 03:01 AM ---------- Previous update was at 02:53 AM ----------

One More Thing ....

How can i add few more line Begging and end of file B:

Ex:

Code:
Start+
G+
PP+
..
...
..

End-
G-
PP-

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Copy the content from txt file and create a html file

I have a txt file with a list of error messages in a xml tag format, and each error message is separated with a identifier(endresult).Need to split that and copy and create a new html file.Error message has some special character. how to escape the special character and insert my data into the... (7 Replies)
Discussion started by: DevAakash
7 Replies

2. Shell Programming and Scripting

Copy text and create new file

I have a directory with ~500 files that look like below. I need to copy each unique entry up until the second_ only once and put a .txt in place of the _. I am not quite sure how but have the below as a startThank you :). cp -u file1.txt "$(cat output.txt)" file1.txt ... (4 Replies)
Discussion started by: cmccabe
4 Replies

3. Shell Programming and Scripting

Curl Script - Post a file (multipart/form-data)

Hi All, I am trying to post an xml file (utf-16 encoded) using curl to a REST service. The REST service is expecting 'multipart/form-data' content type. curl -k -i -H "Content-Type=multipart/form-data" -F "filename=@file.xml;type=text/xml" -X POST -u <username>:<password> <endPointURL> ... (0 Replies)
Discussion started by: Anooja G
0 Replies

4. Shell Programming and Scripting

create txt file form data file

File A.txt LL07 LL07_B_1 20 LL85 LL85_A_1 40 LL85 LL85_B_1 40 LL85 LL85_C_1 30 LL37 LL37_A_1 60 LL37 LL37_B_1 20 LL37 LL37_C_1 50 I want cretae diffrent tex file base of above file Should be threee text file LL07.txt LL85.txt LL37.txt Eaach text file have below data... (2 Replies)
Discussion started by: asavaliya
2 Replies

5. Shell Programming and Scripting

create txt file form data file and add some line on it

Hi Guys, I have file A.txt File A Data AK1521 AK2536 AK3164 I want create text file of all data above and write some data on each file. want Output on below folder /home/kka/out AK1521.txt Hi Welocme (3 Replies)
Discussion started by: asavaliya
3 Replies

6. Programming

help need in the perl script that create one xml file form multiple files.

Hi every one, Please excuse me if any grammatical mistakes is there. I have multiple xml files in one directory, I need to create multiple XML files into one XML file.example files like this</p> file1:bvr.xml ... (0 Replies)
Discussion started by: veerubiji
0 Replies

7. Shell Programming and Scripting

How to cut data from file and create another file.

I have file which has more than 1000 lines. PFB file info Line 1. <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"... (8 Replies)
Discussion started by: humaemo
8 Replies

8. Shell Programming and Scripting

create a new file from data file from a column

I have a data file that has a list of data macthing by user. I am able to sort by user and there is multiple rows for each user. Ideally I would like to email only the user of the files they own. Would it be best to create a seperate file by user and all rows showing the files they own? (9 Replies)
Discussion started by: mykey242
9 Replies

9. UNIX for Dummies Questions & Answers

create data file from report file

Dear Ones, kindly help me to create a data file from the report file as shown here under( i am new one to unix KNOW BASIC COMMANDS) file:rama.prt (ist record)(3 to 4 lines of text with different filed names) Name :M.LALITHA DOB:12/11/45 DESG :JA(P) STANO:300175 ... (3 Replies)
Discussion started by: cvvsnm
3 Replies
Login or Register to Ask a Question