04-08-2008
very urgent
hi friend,
file1.
12345|DZ012|20071220|FG456|234567|IND
| |20080101|DE345|456789|USA
|DZ012| | |500001|AUS
45678|ED456|20011203|ED345|456789|CAN
|SD345| | |456790|MEX
| | |DF232|567890|ARG
56789|WQ456|20071230|WD456|789012|WES
56789|AQ234|20080120|WS456|890123|JAM
when we are running the script we are getting error
awk '{gsub(/^\|| +\|/,"")
if(NF!=6){for(i=1;i<=(6-NF);i++)printf("%s|",k[i]);print;next} {for(i=1;i<=4;i++)k[i]=$i}print}' FS='|' key
out put
12345|DZ012|20071220|FG456|234567|IND
12345|DZ012|20080101|DE345|456789|USA
12345|DZ012|20071220|DZ012|500001|AUS
45678|ED456|20011203|ED345|456789|CAN
45678|ED456|20011203|SD345|456790|MEX
45678|ED456|20011203|DF232|567890|ARG
56789|WQ456|20071230|WD456|789012|WES
56789|AQ234|20080120|WS456|890123|JAM
45678|ED456|20011203|SD345|456790|MEX here the 2n column is repated and the 2nd column moved to 4column.......and the 4th column is missing....some more buggs are there
the above key vlaues should populate as it is...........very urgent
9 More Discussions You Might Find Interesting
1. Solaris
I'm an HPUX/Linux guy, who appreciates occasionally hitting the Esc key for Auto-fill...
Does sunOS have anything like this?
This is my 1st post, and I didn't want to waste it :D
thanks,
manuel (3 Replies)
Discussion started by: mr_manny
3 Replies
2. Shell Programming and Scripting
hi all,
i have a big problem, and i donīt know what to do.
i have a flat file with several fields, which are separated by ";" like this:
5656838-7B;97030000-7;*;V16106133 ;1;1;
4612062-0B;97030000-7;*;C14038149 ;1;2;
8044938-0B;97030000-7;*;V16034219 ;1;2;
where B is a blank space.
... (2 Replies)
Discussion started by: DebianJ
2 Replies
3. UNIX for Dummies Questions & Answers
Hi,
Whenever i press the backspace key, a new line appears, i.e. it works like a enter key. :confused:
Thanks (2 Replies)
Discussion started by: vibhor_agarwali
2 Replies
4. Shell Programming and Scripting
I have a file (key.dat) that contains two columns:
AA|1234|
BB|567|
CC|8910|
I have another file (extract.dat) that contains some data:
SD|458|John|Smith|
AA|3345|Frank|Williams|
AA|1234|Bill|Garner|
BD|0098|Yu|Lin|
BB|567|Gail|Hansen|
CC|8910|Ken|Nielsen|
I want to compare the... (5 Replies)
Discussion started by: ChicagoBlues
5 Replies
5. Shell Programming and Scripting
Hi,
I am new to PERL.I want to sort all the lines in a file based on 1,2 and 4th filelds.
Can U suggest me a command/function in perl for this operation.. (5 Replies)
Discussion started by: karthikd214
5 Replies
6. Shell Programming and Scripting
Hi All,
I have two files to compare. Each has 10 columns with first 4 columns being key index together. The rest of the columns have monetary values.
Using Perl, I want to read one file into hash; check for the key value availability in file 2; then compare the values in the rest of 6... (2 Replies)
Discussion started by: Sangtha
2 Replies
7. Solaris
Hi, I've used the following way to set ssh public key authentication and it is working fine on Solaris 10, RedHat Linux and SuSE Linux servers without any problem. But I got error 'Server refused our key' on Solaris 8 system. Solaris 8 uses SSH2 too. Why? Please help. Thanks.
... (1 Reply)
Discussion started by: aixlover
1 Replies
8. UNIX for Dummies Questions & Answers
Hi experts,
I have been trying for a while to accomplish the following task using awk, and I just don't seem find find a way. I am not particular about using awk, it just seemed like the logical choice at first.
I have a file that contains 5 fields that are delimited by a space character.... (1 Reply)
Discussion started by: GermanicGalore
1 Replies
9. Shell Programming and Scripting
Join and merge multiple files with duplicate key and fill void columns
Hi guys,
I have many files that I want to merge:
file1.csv:
1|abc
1|def
2|ghi
2|jkl
3|mno
3|pqr
file2.csv: (5 Replies)
Discussion started by: yjacknewton
5 Replies
LEARN ABOUT DEBIAN
xkbaddgeomoverlaykey
XkbAddGeomOverlayKey(3) XKB FUNCTIONS XkbAddGeomOverlayKey(3)
NAME
XkbAddGeomOverlayKey - Add a key to an existing overlay row
SYNOPSIS
XkbOverlayKeyPtr XkbAddGeomOverlayKey (XkbOverlayPtr overlay, XkbRowPtr row, char *under);
ARGUMENTS
- overlay
overlay to be updated
- row row in overlay to be updated
- under
primary name of the key to be considered
DESCRIPTION
Xkb provides functions to add a single new element to the top-level keyboard geometry. In each case the num_ * fields of the corresponding
structure is incremented by 1. These functions do not change sz_* unless there is no more room in the array. Some of these functions fill
in the values of the element's structure from the arguments. For other functions, you must explicitly write code to fill the structure's
elements.
The top-level geometry description includes a list of geometry properties. A geometry property associates an arbitrary string with an
equally arbitrary name. Programs that display images of keyboards can use geometry properties as hints, but they are not interpreted by
Xkb. No other geometry structures refer to geometry properties.
XkbAddGeomOverlayKey adds one key to the row in the overlay. If there is no key named under in the row of the underlying section, XkbAd-
dGeomOverlayKey returns NULL.
STRUCTURES
typedef struct _XkbOverlayKey {
XkbKeyNameRec over; /* name of this overlay key */
XkbKeyNameRec under; /* name of the key under this overlay key */
} XkbOverlayKeyRec,*XkbOverlayKeyPtr;
X Version 11 libX11 1.5.0 XkbAddGeomOverlayKey(3)