08-21-2007
File manipulation with awk
Could you please help me to achieve the below:
In a file I need to convert the multiple lines whose filed 1 and field 5 values are same into a single line but with the field 4 values comma separed as mentioned below. Fileds after 5 shall be discarded.
Also here by default all other remaining fields will be same.
I/P:
WOR|573|10024|2853369|P|Sto|1|
WOR|573|10024|11358|P|Bir|27|
WOR|573|10024|11101|R|Fta|14|
WOR|573|10024|11067|R|Col|11|
SAS|573|10024|2853369|P|Sto|1|
SAS|573|10024|11358|P|Bir|27|
SAS|573|10024|11270|P|Bat|11|
SAS|573|10024|10968|R|PanA FDMx|10|
SAS|573|10024|10950|R|Mac|2|
O/P
WOR|573|10024|2853369,11358|P|
WOR|573|10024|11101,11067|R|
SAS|573|10024|2853369,11358,11270|P|
SAS|573|10024|11101,11067|R|
Thanks,
Dhams
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi ,
what a wonderful command but so hard to maintain !
i have a file like that :
03/07/2006 05:58:45
03/07/2006 06:58:45
03/07/2006 07:58:50
03/07/2006 08:58:50
and i want to read it and keep only the lines with 3rd field less than 07:00:00
writing it in a second file !
... (2 Replies)
Discussion started by: Nicol
2 Replies
2. Shell Programming and Scripting
Hi All,
I have a file having content,
$ cat data1.txt
20060620 142 62310 959400 A 5.00
20060620 142 62310 959400 B 3.00
20060620 143 62310 959401 A 7.00
20060620 143 62310 959401 B 4.00
20060620 144 62310 959402 A 8.00
20060620 144 62310... (6 Replies)
Discussion started by: rinku11
6 Replies
3. Shell Programming and Scripting
OK, so if $0 represent the entire record... can I change $2 and will that be reflected back in $0?
I think the following answers that YES, it does work. But is there anything I should be thinking about prior to doing this? What I am actually doing is part of 5 pages of scripting and awk... (1 Reply)
Discussion started by: joeyg
1 Replies
4. Shell Programming and Scripting
Hello
How do i check that correct input files are used while using AWk and SED for file manipulation?
e.g
awk '/bin/ {print $0 }' shell.txt
sed 's/hp/samsung/' printers.txt
how do i ensure that the correct input files I am working with are used? (5 Replies)
Discussion started by: Pauline mugisha
5 Replies
5. Shell Programming and Scripting
I have large number of data files, close to 300 files, lets say all files are same kind and have extension .dat , each file have mulitple lines in it.
There is a unique line in each file containing string 'SERVER'. Right after this line there is another line which contain a string 'DIGIT=0',... (4 Replies)
Discussion started by: sal_tx
4 Replies
6. Shell Programming and Scripting
I have got a sample file below(colon(:) is the field separator) . The data is like
col1:col2:col3:col4:col5:col6:col7:col8:col9:col10
11:12:012:aa:a a a:10::111:12:
311:321:320:caad::321:31:3333::
2:22:222::bbb::cads::2222:20
:::::12:1234::12:
:5:55::555:5555::::55550
Now I want to find... (9 Replies)
Discussion started by: rinku11
9 Replies
7. UNIX for Dummies Questions & Answers
Hello,
I am having issues generating the output file below from this input file:
Basically, what I want is if the ID= matches with the line below to print the first value in column 3 and the last value of column 4 for the matching ID's. The ID's can repeat more than twice, however, they... (2 Replies)
Discussion started by: verse123
2 Replies
8. Shell Programming and Scripting
Hi ,
I have a simple text file with contents as below:
12345678900 971,76 4234560890
22345678900 5971,72 5234560990
32345678900 71,12 6234560190
the new csv-file should be like:
Column1;Column2;Column3;Column4;Column5
123456;78900;971,76;423456;0890... (9 Replies)
Discussion started by: FreddyDaKing
9 Replies
9. Shell Programming and Scripting
Hallo Family,
I have csv file which has over a million records in it. All i want to do is to change field 2 to have the same value as field 10.
sample file:Now
0860093239,Anonymous,unconditional,+27381230283,Anonymous,unconditional,y,public,,2965511477:0A
Desired output:
... (2 Replies)
Discussion started by: kekanap
2 Replies
10. Shell Programming and Scripting
hello
I have example file
AA 11
BB 22
CC 33
And what I expect to have
-a AA=11 -a BB=22 -a CC=33
can anyone help how I have this using awk? (1 Reply)
Discussion started by: vikus
1 Replies
MFI(4) BSD Kernel Interfaces Manual MFI(4)
NAME
mfi -- LSI MegaRAID SAS driver
SYNOPSIS
To compile this driver into the kernel, place the following lines in your kernel configuration file:
device pci
device mfi
Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5):
mfi_load="YES"
DESCRIPTION
This driver is for LSI's next generation PCI Express SAS RAID controllers. Access to RAID arrays (logical disks) from this driver is pro-
vided via /dev/mfid? device nodes. A simple management interface is also provided on a per-controller basis via the /dev/mfi? device node.
The mfi name is derived from the phrase "MegaRAID Firmware Interface", which is substantially different than the old "MegaRAID" interface and
thus requires a new driver. Older SCSI and SATA MegaRAID cards are supported by amr(4) and will not work with this driver.
Two sysctls are provided to tune the mfi driver's behavior when a request is made to remove a mounted volume. By default the driver will
disallow any requests to remove a mounted volume. If the sysctl dev.mfi.%d.delete_busy_volumes is set to 1, then the driver will allow
mounted volumes to be removed.
HARDWARE
The mfi driver supports the following hardware:
o LSI MegaRAID SAS 1078
o LSI MegaRAID SAS 8408E
o LSI MegaRAID SAS 8480E
o LSI MegaRAID SAS 9260
o Dell PERC5
o Dell PERC6
o IBM ServeRAID M5015 SAS/SATA
o IBM ServeRAID-MR10i
o Intel RAID Controller SROMBSAS18E
FILES
/dev/mfid? array/logical disk interface
/dev/mfi? management interface
DIAGNOSTICS
mfid%d: Unable to delete busy device An attempt was made to remove a mounted volume.
SEE ALSO
amr(4), pci(4), mfiutil(8)
HISTORY
The mfi driver first appeared in FreeBSD 6.1.
AUTHORS
The mfi driver and this manual page were written by Scott Long <scottl@FreeBSD.org>.
BUGS
The driver does not support big-endian architectures at this time.
BSD
May 12, 2010 BSD