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
TZSELECT(8)						      System Manager's Manual						       TZSELECT(8)

NAME
tzselect - select a time zone SYNOPSIS
tzselect DESCRIPTION
The tzselect program asks the user for information about the current location, and outputs the resulting time zone description to standard output. The output is suitable as a value for the TZ environment variable. All interaction with the user is done via standard input and standard error. ENVIRONMENT VARIABLES
AWK Name of a Posix-compliant awk program (default: awk). TZDIR Name of the directory containing time zone data files (default: /usr/local/etc/zoneinfo). FILES
TZDIR/iso3166.tab Table of ISO 3166 2-letter country codes and country names. TZDIR/zone.tab Table of country codes, latitude and longitude, TZ values, and descriptive comments. TZDIR/TZ Time zone data file for time zone TZ. EXIT STATUS
The exit status is zero if a time zone was successfully obtained from the user, nonzero otherwise. SEE ALSO
newctime(3), tzfile(5), zdump(8), zic(8) TZSELECT(8)
All times are GMT -4. The time now is 11:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy