Sponsored Content
Full Discussion: Column wise file parsing.
Top Forums Shell Programming and Scripting Column wise file parsing. Post 302282828 by angheloko on Monday 2nd of February 2009 01:39:09 AM
Old 02-02-2009
Hope this helps:

Code:
sed "s/^NAD.*$//" FileA | tr -d "\n" | sed "s/SEQ++/\n/g;s/MOA+/,/g;s/RFF+AIK:/,/g;s/FII+PH+/,/g;" | sed '1d'

Changes keywords into a comma ","

So that output will be:

Code:
$ sed "s/^NAD.*$//" FileA | tr -d "\n" | sed "s/SEQ++/\n/g;s/MOA+/,/g;s/RFF+AIK
:/,/g;s/FII+PH+/,/g;" | sed '1d'
1',9:000,00:ABC',000000007',0170++AA'
2',9:389,47:ABC',02110300000008',0PSTBNL2A:25:5+BB'
3',9:3086,55DD',00009',0348932928++GG'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

processing matrix column wise

I have a m X n matrix written out to file, say like this: 1,2,3,4,5,6 2,6,3,10,34,67 1,45,6,7,8,8 I want to calculate the column averages in the MINIMUM amount of code or processing possible. I would have liked to use my favorite tool, "AWK" but since it processes rowwise, getting the... (5 Replies)
Discussion started by: Abhishek Ghose
5 Replies

2. Shell Programming and Scripting

o/p column wise by nawk

hi i have file which hav following entries 1501,AAA,2.00 1525,AAA,2.00 1501,AAA,2.00 1525,AAA,2.00 1501,AAA,3.00 1525,AAA,3.00 1525,AAA,3.00 1501,AAA,3.00 1501,AAA,3.00 i want to have a o/p coloum wise like 1501,AAA,13 1525,AAA,10 here 13 comes as a sum of last colum value... (6 Replies)
Discussion started by: aaysa123
6 Replies

3. Solaris

column wise substitution in a file

Hi, I have two files. Want to make an addition of the fifth column of from both the files and redirect it to a third file. Both files have same records except fifth field and same record should be inserted into new file having fifth field as addition of fifth fields of both files. for... (2 Replies)
Discussion started by: sanjay1979
2 Replies

4. Shell Programming and Scripting

Search a file column wise and delete it

i have a file which has a column that is unique i am intending to serach it and if it is there to remove the row. the file looks like ROLLNO,NAME ,SUB1,SUB2,SUB3,TOTAL,PERCENTAGE,RESULT 15 ,rig ,34 ,56 ,87 ,177 ,59 % ,PASS 23 ,wel ,45 ,76 ,56 ,177 ,59 % ... (0 Replies)
Discussion started by: gotam
0 Replies

5. Shell Programming and Scripting

Search a file column wise and delete it

Scottn, m really sorry but i have not got my answer yet. my concern is how to delete the row !!! i have a file which has a column that is unique i am intending to serach it and if it is there to remove the row. the file looks like ROLLNO,NAME ,SUB1,SUB2,SUB3,TOTAL,PERCENTAGE,RESULT... (9 Replies)
Discussion started by: gotam
9 Replies

6. Shell Programming and Scripting

read file line by line print column wise

I have a .csv file which is seperated with (;) inputfile --------- ZZZZ;AAAA;BBB;CCCC;DDD;EEE; YYYY;BBBB;CCC;DDDD;EEE;FFF; ... ... reading file line by line till end of file. while reading each line output format should be . i need to print only specific columns let say 5th... (2 Replies)
Discussion started by: rocking77
2 Replies

7. Shell Programming and Scripting

Adding content of two file in a single file column wise

Hi, I am trying to get the file in particular pattern using shell script. I have to add one column to some other file. For example consider two file as below. File1: name1 name2 name3 File2: Add1 age1 Add2 age2 Add3 age3 I want this two file in a single file format something like... (3 Replies)
Discussion started by: diehard
3 Replies

8. Red Hat

How to find a garbage entry in a column wise text file in Linux?

Suppose I have a file containing :- 1 Apple $50 2 Orange $30 3 Banana $10 4 Guava $25 5 Pine@apple $12 6 Strawberry $21 7 Grapes $12 In the 5th row, @ character inserted. I want through sort command or by any other way this row should either on top or bottom. By sort command garbage... (1 Reply)
Discussion started by: Dipankar Mitra
1 Replies

9. Shell Programming and Scripting

Column wise text adding

Hi I have pasted sample data as below:- in data.txt Please suggest any way out: as the 3rd field is cat data.txt 22:37:34 STARTING abc 22:37:40 FAILURE sadn 00:06:42 STARTING asd 00:06:51 FAILURE ad 02:06:38 STARTING acs 02:06:46 FAILURE cz 04:06:35 STARTING xzc... (1 Reply)
Discussion started by: Gaurav198
1 Replies

10. Shell Programming and Scripting

Proper Column wise matching

My below code works fine if none of the columns has pipe as its content in it, If it has the pipe in any of the content then the value moves to the next column. I wanted my code to work fine even if the column has pipe in it apart from the delimiter. NOTE : If there is a pipe in the content... (6 Replies)
Discussion started by: nikhil jain
6 Replies
PERLCN(1)						 Perl Programmers Reference Guide						 PERLCN(1)

NAME
perlcn - XXXX Perl XX DESCRIPTION
XXXX Perl XXX! X 5.8.0 XXX, Perl XXXXXX Unicode (XXX) XX, XXXXXXXXXXXXXXXXXXX; CJK (XXX) XXXXXXXX. Unicode XXXXXXX, XXXXXXXXXXXX: XXXX, XXXX, XXXXXXXX (XXX, XXXX, XXXX, XXXX, XXX, XXXX, XX). XXXXXXXXXXXXXX (X PC XXXX). Perl XXX Unicode XXXX. XXX Perl XXXXXXXXXX Unicode XX; Perl XXXXXX (XXXXXXXXX) XXX Unicode XXXX. XXXXXXX, XXXXX Unicode XXXXXXXXXXXX, Perl XXX Encode XXXX, XXXXXXXXXXXXXXXXXXX. Encode XXXXXXXXXXXXXXXXX ('gb2312' XX 'euc-cn'): euc-cn Unix XXXXX, XXXXXXXXX gb2312-raw XXXXX (XXX) GB2312 XXX gb12345 XXXXXXXXXXXXXX iso-ir-165 GB2312 + GB6345 + GB8565 + XXXX cp936 XXX 936, XXXX 'GBK' (XXXXX) XX hz 7 XXXXX GB2312 XX XXXX, X EUC-CN XXXXXXX Unicode, XXXXXXXX: perl -Mencoding=euc-cn,STDOUT,utf8 -pe1 < file.euc-cn > file.utf8 Perl XXXX "piconv", XXXXX Perl XXXXXXXXXXX, XXXX: piconv -f euc-cn -t utf8 < file.euc-cn > file.utf8 piconv -f utf8 -t euc-cn < file.utf8 > file.euc-cn XX, XX encoding XX, XXXXXXXXXXXXXXXXX, XXXX: #!/usr/bin/env perl # XX euc-cn XXXX; XXXXXXXXXXXXX euc-cn XX use encoding 'euc-cn', STDIN => 'euc-cn', STDOUT => 'euc-cn'; print length("XX"); # 2 (XXXXXXX) print length('XX'); # 4 (XXXXXXX) print index("XXXX", "XX"); # -1 (XXXXXXXX) print index('XXXX', 'XX'); # 1 (XXXXXXXX) XXXXXXXX, "X" XXXXXXX "X" XXXXXXXXX EUC-CN XX "X"; "X" XXXXXXXX "X" XXXXXXXXX "X". XXXXXX EUC-CN XXXXXXXXXXX. XXXXXXX XXXXXXXXXXX, XXX CPAN (<http://www.cpan.org/>) XX Encode::HanExtra XX. XXXXXXXXXXX: gb18030 XXXXXXX, XXXXXX XX, Encode::HanConvert XXXXXXXXXXXXXXXX: big5-simp Big5 XXXXX Unicode XXXXXX gbk-trad GBK XXXXX Unicode XXXXXX XXX GBK X Big5 XXXX, XXXXXXXXX b2g.pl X g2b.pl XXXX, XXXXXXXXXXX: use Encode::HanConvert; $euc_cn = big5_to_gb($big5); # X Big5 XX GBK $big5 = gb_to_big5($euc_cn); # X GBK XX Big5 XXXXXX XXX Perl XXXXXXXXX (XXXXXXXXX), XXXXXXX Perl XXX, XX Unicode XXXXX. XX, XXXXXXXXX: XX Perl XXXXX <http://www.perl.com/> Perl XXX (XXXXXXXX) <http://www.cpan.org/> Perl XXXXX (Comprehensive Perl Archive Network) <http://lists.perl.org/> Perl XXXXXX XX Perl XXX <http://www.oreilly.com.cn/index.php?func=booklist&cat=68> XXXXXXXXX Perl XX Perl XXXXX <http://www.pm.org/groups/asia.html> XX Perl XXXXX Unicode XXXX <http://www.unicode.org/> Unicode XXXX (Unicode XXXXXX) <http://www.cl.cam.ac.uk/%7Emgk25/unicode.html> Unix/Linux XX UTF-8 X Unicode XXX SEE ALSO
Encode, Encode::CN, encoding, perluniintro, perlunicode AUTHORS
Jarkko Hietaniemi <jhi@iki.fi> Audrey Tang (XX) <audreyt@audreyt.org> perl v5.16.2 2012-10-11 PERLCN(1)
All times are GMT -4. The time now is 05:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy