![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| modifying grep to get files only within last 2 hrs | ragha81 | Shell Programming and Scripting | 3 | 01-11-2007 04:11 PM |
| modifying grep to return latest files | ragha81 | Shell Programming and Scripting | 4 | 12-28-2006 01:09 PM |
| modifying C file and linking back to project files | bruins2005 | UNIX for Dummies Questions & Answers | 1 | 06-22-2006 08:08 PM |
| Perl - Appending/Modifying Excel files | srinivay | Shell Programming and Scripting | 2 | 01-10-2005 03:46 AM |
| text files, ASCII files, binary files and ftp transfers | Perderabo | Answers to Frequently Asked Questions | 0 | 04-08-2004 01:25 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi Everybody!
Situation: I have a large ASCII file (for example: 1-2 Mbytes) without linebreaks (\n). Task: I like inserting linebreaks after all 420 digits (byte). (pattern: *[420pcs]\n*[420pcs]\n*[420pcs]\n...etc.) My problem: How? :-) I like using shell script or (maybe) AWK (short) program. Please, help me. Bye hviktor |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
I dont think you will find a way to do that with a shell script. The only command that I know of would be csplit in a CShell script. this command only allow as maximum of 100 characters to be read at a time. I would suggest you look at a small C program to read the file character by character using a for loop.
|
|
#3
|
|||
|
|||
|
Code:
cat $file|sed ' s/420pcs/420pcs\ /gw newfile' |
|||
| Google The UNIX and Linux Forums |