Sponsored Content
Top Forums Shell Programming and Scripting concat 6 files in 1 file ( maybe use AWK?) Post 302235717 by naoseionome on Friday 12th of September 2008 01:45:45 PM
Old 09-12-2008
better example

explaining my situation best:




the information may came like this:

410000000000001,dummy, data,separated,by,comma,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,
410000000000002,,dummy, data,separated,by,comma,,,,,,,,
410000000000003,,dummy, data,separated,by,comma,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,

and in some files i cames with the first value in all the lines.
like this:
410000000000002,,dummy, data,separated,by,comma,,,,,,,,
410000000000003,,dummy, data,separated,by,comma,,,,,,,,

i want it to stay like for each file:

X,410000000000001,dummy, data,separated,by,comma,,,,,,,,
X,410000000000001,,,,,,,,,,,,,,,,,,,,,,,,,
X,410000000000001,,,,,,,,,,,,,,,,,,,,,,,,,
X,410000000000001,,,,,,,,,,,,,,,,,,,,,,,,,
X,410000000000002,,dummy, data,separated,by,comma,,,,,,,,
X,410000000000003,,dummy, data,separated,by,comma,,,,,,,,
X,410000000000003,,,,,,,,,,,,,,,,,,,,,,,,,

or like this:
410000000000001,X,dummy, data,separated,by,comma,,,,,,,,
410000000000001,X,,,,,,,,,,,,,,,,,,,,,,,,,,
410000000000001,X,,,,,,,,,,,,,,,,,,,,,,,,,,
410000000000001,X,,,,,,,,,,,,,,,,,,,,,,,,,,
410000000000002,X,,dummy, data,separated,by,comma,,,,,,,,
410000000000003,X,,dummy, data,separated,by,comma,,,,,,,,
410000000000003,X,,,,,,,,,,,,,,,,,,,,,,,,,,

the final result depends on how the sort function works because i need the sort to be done by the value 4100000000000XXX.

And for final result i need this:
1,410000000000001,,dummy, data,separated,by,comma,,,,,,,,
2,410000000000001,,dummy, data,separated,by,comma,,,,,,,,
3,410000000000001,,dummy, data,separated,by,comma,,,,,,,,
...
7,410000000000001,,dummy, data,separated,by,comma,,,,,,,,
1,410000000000002,,dummy, data,separated,by,comma,,,,,,,,
2,410000000000002,,dummy, data,separated,by,comma,,,,,,,,


which means, i need to sort the files by the number 4100000000000XX in order to process all the information for the same number sequentially ( it goes to a oracle database after processing)

I hope this explains my situation best and that you can help me.

best regards,
Ricardo Tomás
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Search and then concat 4m other file (comma seperated)

My query is now a bit simplified. file1.txt names; ID; value1 ; values N; ABC; 1 ; a18 ; ... CDF; 2 ; b16 ; .. ABC; 1 ; c13 ; ...... EFG; 3 ;d12 ; ... file2.txt ID(Unique);smVals; smVal1; smVal N; 1; ...; ...; ...; 2; ..; ..; ..; 3; ..; ..; ..; ... (1 Reply)
Discussion started by: szchmaltz
1 Replies

2. Shell Programming and Scripting

Conditional concat lines awk

Hello, I have a text file like this: NONE FILE_Rename frompath: /log_audit/AIX/log/current/AIXAFTPP.log NONE FILE_Unlink filename /audit/tempfile.14041142 NONE FILE_Rename ... (8 Replies)
Discussion started by: carloskl
8 Replies

3. Programming

Concat of two html file

By launching two SQL scripts I get two html files report_1.html and report_2.html with different background and text colors (white/blue for the former and silver/black for the latter) but if I try to concat the two html by using the CAT function on UNIX Server where Oracle is installed (cat... (1 Reply)
Discussion started by: Mark1970
1 Replies

4. Web Development

Concat of two html files

By launching two SQL scripts I get two html files report_1.html and report_2.html with different background and text colors (white/blue for the former and silver/black for the latter) but if I try to concat the two html by using the CAT function on UNIX Server where Oracle is installed (cat... (2 Replies)
Discussion started by: Mark1970
2 Replies

5. Shell Programming and Scripting

Awk Concat

Hi All this may be somewhere in internet , but couldnt find the it. i have file as abc01 2010-07-01 12:45:24 2010-07-01 12:54:35 abc02 2010-07-01 12:59:24 2010-07-01 01:05:13 abc03 . . . the output using awk should look like this abc01|2010-07-01 12:45:24|2010-07-01 12:54:35... (3 Replies)
Discussion started by: posner
3 Replies

6. Shell Programming and Scripting

Need help in concat of two lines in a file

Hi , Need help in concating two lines based on certain character, for example my file has the messages : :57A:qweqweww :58A:qeqewqeqe -}$ {1:fffff2232323}{2:123123dasds}{4: :20:121323232323232 :21:sdsadasdasddadad if the line ends with "-}$" or if a line starts with "{1:" then it... (5 Replies)
Discussion started by: ulin
5 Replies

7. Shell Programming and Scripting

concat 3 files

Hello Unix gurus, how to concat 3 files content side by side . i have 3 files more report1.txt select *from tab1 A JOIN tab1 B ON more report2.txt A.PK1=B.PK1 where more report3.txt A.AAA <> B.AAA or A.BBB <> B.BBB or A.CCC<> B.CCCC or .. .. .. A.ZZZ <> B.ZZZ; if i concatinate... (3 Replies)
Discussion started by: kanakaraju
3 Replies

8. Shell Programming and Scripting

awk concat lines between 2 sequent digits

I would like to print string between two sequent digits and concatenate it into one single line. input.txt 99 cord, rope, strand, twine, twist, 100 strand, twine, twist, cord, rope 101 strand, twine, twist, twine, twist, cord, rope 105 cord, rope ,twi ... (8 Replies)
Discussion started by: sdf
8 Replies

9. UNIX for Dummies Questions & Answers

concat any two lines in a file

I have a file with line 4 : F SITE SPA_M2 SPA_M3 SPA_M4 and a line 237 with: BV_N4 VbdGO_PW Rs_NW_STI Rc_N+OD need a awk liner to concat the two lines so that line 2 sits next to line1 and looks like: F SITE SPA_M2 SPA_M3 SPA_M4 BV_N4 VbdGO_PW ... (8 Replies)
Discussion started by: awkaddict
8 Replies

10. Shell Programming and Scripting

Concat String with variable after a 'grep' and awk

Here is the structure of my file: MyFile.txt g-4.n.g.fr 10.147.243.63 g-4.n.g.fr-w1 Here is my sript: test.sh #! /bin/sh ip=10.147.243.63 worker=$(grep -e $ip $1 | awk '{ print $3; }') echo "" echo $worker echo "" echo $worker echo "" echo "$worker.v.1" echo... (7 Replies)
Discussion started by: chercheur111
7 Replies
KAWARI8(6)							   Games Manual 							KAWARI8(6)

NAME
kawari_encode, kawari_encode2, kawari_decode2 -- kawari 8.0 encoder/decoder SYNOPSIS
kawari_encode [file ...] kawari_encode2 [file ...] kawari_decode2 [file ...] DESCRIPTION
This manual page documents briefly the kawari command. This manual page was written for the Debian distribution because the original program does not have a manual page. Instead, it has docu- mentation written in HTML format. For detailed descriptions, see doc-base. kawari_encode encodes kawari scripts to an encoded file. So the users for the scripts cannot easily read the content. It can be used to protect the content of Kawari scripts. It takes several text files as inputs and converts them to .kaw files separately. kawari_encode2 is an advanced kawari_encode. It is able to assign a symmetric key like some encrypting systems. The key affects the encod- ing system. Users need the key to decode them. kawari_decode2 is a decoder of the .kaw files. It takes several .kaw files and convert them back to .txt files. If the kaw files is encoded by kawari_encode2, the key must be provided correctly for decoding. AUTHOR
This manual page was written by Ying-Chun Liu (PaulLiu) <grandpaul@gmail.com> for the Debian system (but may be used by others). This man- ual page is in public domain and is freely reproduced, distributed, transmitted, used, modified, built upon, or otherwise exploited by any- one for any purpose, commercial or non-commercial, and in any way, including by methods that have not yet been invented or conceived. KAWARI8(6)
All times are GMT -4. The time now is 05:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy