![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Print Full record and substring in that record | ukatru | UNIX for Advanced & Expert Users | 1 | 09-19-2008 06:32 PM |
| how to read record by record from a file in unix | raoscb | UNIX for Dummies Questions & Answers | 1 | 05-16-2008 06:30 AM |
| Splitting a file based on record sin another file | er_ashu | UNIX for Dummies Questions & Answers | 7 | 05-15-2008 11:06 PM |
| Script to search a bad record in a file then put the record in the bad file | shilendrajadon | Shell Programming and Scripting | 2 | 12-28-2007 10:02 AM |
| splitting a record and adding a record to a file | rsolap | Shell Programming and Scripting | 1 | 08-13-2007 01:58 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Record splitting with AWK
Hi all !
I need your help as quick as possible. My input file like this: bạc t́nh ( 薄情) 1 . 薄情な.2. 夫婦或いは男女の不貞を指す。 bách (百,迫)1.100ドソ. tr a m b a c ともいう. 2.柏(カヽしわ)・ 3.圧迫する.4.差し迫った, My propose is take the value in the firt bracket. I used the command like : ...if (index( $3,"(")==1)$3=substr($3,2,index($3,")")-1); else if (index( $3,"(")==1)$3=substr($3,2,index($3,")1."-3); and my result with the fist line, i take the value 薄情. but the second line, the value is wrong. Because it took 百,迫)1.100ドソ. tr a m b a c ともいう. 2.柏(カヽしわ. but I want to take the 百,迫. So what can I do? |
|
||||
|
Thanks!
Before, I do like this:
BEGIN { FS="\t";RS="\n"; } Because now I want to take the words during ( ), and $3 it means the value I will take. I write like this if (index( $3,"(")==0 && index($3,"・・)==0)$3=""; else if (index( $3,"(")==1)$3=substr($3,2,index($3,"・・)-2); My result will have 2 column, 1 is bách and the second column is 百,迫 but now I have problem when the lines have 2 ( ) like this bách (百,迫)1.100ドソ. tr a m b a c ともいう. 2.柏(カヽしわ) After the bách I use tab code(button) and before the bách I also using the tab code. And my result is bách 百,迫)1.100ドソ. tr a m b a c ともいう. 2.柏(カヽしわ Then could you help me to fix my mistake? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|