![]() |
|
|
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 |
| Dividing single file by lines? | anoc | Shell Programming and Scripting | 1 | 04-08-2008 02:08 PM |
| Dividing float values | shash | UNIX for Dummies Questions & Answers | 3 | 01-17-2007 05:37 AM |
| dividing a file into two | jazz | High Level Programming | 2 | 10-20-2006 08:55 AM |
| Scipt to do login | rahulrathod | Shell Programming and Scripting | 1 | 10-05-2004 05:29 AM |
| dividing the screen >>> | ShockTeam | UNIX for Dummies Questions & Answers | 4 | 11-06-2001 08:29 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
scipt dividing strings /reg expr
Hello! I've got txt-file containing lots of data in sentences like this: Code:
;;BA;00:00:03:00;COM;CLOQUET-LAFOLLYE;SIMON; but sometime more than on in a line like this: Code:
;;BA;00:00:03:00;COM;CLOQUET-LAFOLLYE;SIMON;;;BA;00:00:03:00;REA;RTL9;;;;BAC;:00;TIT;SEMAINE SPECIALE ~SSLOGAN~T DVD;; Now I would like to cut this down that I have only one sentence per row: Code:
;;BA;00:00:03:00;COM;CLOQUET-LAFOLLYE;SIMON; ;;BA;00:00:03:00;REA;RTL9;; ;;BAC;:00;TIT;SEMAINE SPECIALE ~SSLOGAN~T DVD;; (So I need a break after every 7th ";"). I tried Code:
echo `awk '{gsub("[;][.]\{0;}[;][.]\{0;}[;][.]\{0;}[;][.]\{0;}[;][.]\{0;}[;][.]\{0;}","[;][.]\{0;}[;][.]\{0;}[;][.]\{0;}[;][.]\{0;}[;][.]\{0;}[;][.]\{0;}\012");print $0}' $fileName0 > $fileName1`
but this is obviously completly wrong... ![]() Does anybody have an good idea how I could get the results I want?!? Thanks very much for any kind of help! |
|
||||
|
Thanks for that, it's working very well. But now I've got another, very similar problem... ![]() I've got the same data: Code:
FP7F111;;BAC;00:00:30:00;TIT;SEMAINE SPECIALE “BANDE DE SAUVAGES”;; ;;BA;00:00:03:00;COM;CLOQUET-LAFOLLYE;SIMON; ;;BA;00:00:03:00;REA;RTL9;; ;;BAC;:00;TIT;SEMAINE SPECIALE “BANDE DE SAUVAGES”;; but now I have to remove all the linebreake (ASCII 12) so that it looks like this: Code:
FP7F111;;BAC;00:00:30:00;TIT;SEMAINE SPECIALE “BANDE DE SAUVAGES”;;;;BA;00:00:03:00;COM;CLOQUET-LAFOLLYE;SIMON;;;BA;00:00:03:00;REA;RTL9;;;;BAC;:00;TIT;SEMAINE SPECIALE “BANDE DE SAUVAGES”;; And I have this time absolutly no idea how to do this... Sorry for my stupid qustions, I think I have to get some experience with reg expr's very quickly... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|