![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| comparing and inserting common line in other file | namishtiwari | Shell Programming and Scripting | 2 | 03-25-2008 08:09 AM |
| Inserting New Line in File using Sed ?? | Mary_xxx | Shell Programming and Scripting | 4 | 02-27-2008 04:50 PM |
| inserting line?? | anj | UNIX for Dummies Questions & Answers | 7 | 11-03-2007 12:18 PM |
| Inserting character in every line | dakid | Shell Programming and Scripting | 1 | 08-25-2006 08:54 AM |
| inserting characters before each line... | Nicol | Shell Programming and Scripting | 4 | 09-02-2004 05:40 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
inserting a new line in a file
I'm sure you guys have answered this elsewhere but I can't seem to find where so here goes.
#!/bin/bash n=120 a=$(sed '120q;d' energy.xvg) while [ a != exit ];do a=$(sed $n'q;d' energy.xvg) echo "$a \n" > newfile n=$(($n+100)) done exit 0 that script should read the file energy.xvg, start at line 120, and copy every 100th line to newfile. The problem is that it only outputs to one line in the file and so every line overwrites the one before it. I want it to write to a new line each time. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|