Sponsored Content
Top Forums Shell Programming and Scripting sed/awk to insert comment at defined line number Post 34829 by homefp on Friday 14th of March 2003 08:33:36 AM
Old 03-14-2003
In fact one line command only to replace sequential sed commands as :

sed '/labe/{n;n;d;}' < filein > fileout; mv fileout filein
sed '/label/{n;d;}' < filein > fileout; mv fileout filein
sed '/label/d' < filein > fileout; mv fileout filein

thanks,
homefp Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed to have defined positionning on line

Hi, I'd like to know how to use sed to position my output to a defined location on a line. Here is my example: A: filename.txt => line x : comment fromA B: very longfilename.txt => line xyzabd : commentfromB and I'd like to have as output from sed : A: filename.txt................=> ... (10 Replies)
Discussion started by: homefp
10 Replies

2. Shell Programming and Scripting

awk or sed for finding closest pattern to a line number

hi guys, I want to do pattern matching with awk or sed but I don't know how. here's what I want: I have a line number for a pattern that I have already found using grep, and I know a pattern like "---" that happens a few lines above that certain line number. I want to print out the chunk... (1 Reply)
Discussion started by: alirezan
1 Replies

3. UNIX for Dummies Questions & Answers

Using awk to get a line number to delete, piping through sed

Alright, I'm sure there's a more efficient way to do this... I'm not an expert by any means. What I'm trying to do is search a file for lines that match the two input words (first name, last name) in order to remove that line. The removal part is what I'm struggling with. Here is my code: echo... (4 Replies)
Discussion started by: lazypeterson
4 Replies

4. Shell Programming and Scripting

Using sed to comment out line in /etc/vfstab

I am running a script remotely to do the following 1. Kill all processes by a user 2. Uninstall certain packages 3. FTP over a new file 4. Kill a ldap process that is not allowing my /devdsk/c0t0d0s7 slice to un-mount 5. Unmount /h 6. comment out the slice in vfstab 7. newfs the... (9 Replies)
Discussion started by: deaconf19
9 Replies

5. Shell Programming and Scripting

Comment a line with SED

I have around 25 hosts and each hosts has 4 instance of jboss and 4 different ip attached to it . I need to make some changes to the startup scripts. Any tips appreciated. I have total of 100 instances which bind to 100 different ip address based on instance name. For example File1 ... (1 Reply)
Discussion started by: gubbu
1 Replies

6. Shell Programming and Scripting

Awk to extract lines with a defined number of characters

This is my problem, my file (file A) contains the following information: Now, I would like to create a file (file B) containing only the lines with 10 or more characters but less than 20 with their corresponding ID: Then, I need to compare the entries and determine their frequency. Thus, I... (7 Replies)
Discussion started by: Xterra
7 Replies

7. Shell Programming and Scripting

Help on Sed/awk/getting line number from file

I Have file1 with below lines : #HostNameSelection=0 :NotUsed #HostNameSelection=1 :Automatic #HostNameSelection=3 :NotForced I have file2 which has similar lines but with different values I want to copy the changes from file1 to file2 ,line by line only if line begins with '#'. for... (7 Replies)
Discussion started by: mvr
7 Replies

8. Shell Programming and Scripting

sed and awk to insert a line after a para

hi I am having a file like this ############################## mod1 ( a(ll) , b( c), try(o) , oll(ll) go(oo) , al(ll) mm(al) , lpo(kka) kka(oop) ); mod2 ( jj(ll) , c( kk), try1q(o1) , ofll(lll) gao(oo1) , ala(llaa) mmf(adl) , lddpo(kkad) kkda(oodp) );... (20 Replies)
Discussion started by: kshitij
20 Replies

9. Shell Programming and Scripting

Insert a value in a pipe delimited line (unsig sed,awk)

Hi, I want to insert a value (x) in the 3rd position of each line in a file like below a|b|c|d|1 a|b|c|d a|b|c|d|e|1 a|b|cso that output file looks like a|b|x|c|d|1 a|b|x|c|d a|b|x|c|d|e|1 a|b|x|cI can do that using perl as below #!/usr/bin/perl -w use strict; #inserting x at... (5 Replies)
Discussion started by: sam05121988
5 Replies

10. UNIX for Beginners Questions & Answers

selection particular number of line from a bunch by user defined limits.

hello i am having a file having a matrix as the following 4.1 5.5 6.55 7.2 8.2 1.002 i am having around 1 lakh rows, now i need a program in which i show give min x and min y and min z values and as well as max x max y max z, the values between these minimun and maximum values should be... (1 Reply)
Discussion started by: charan pattabhi
1 Replies
RECOVERDM(1)						      General Commands Manual						      RECOVERDM(1)

NAME
recoverdm - recover filesdisks with damaged sectors SYNOPSIS
recoverdm -t type -i filedevicein -o fileout [-l list] [-n retries] [-s speed] DESCRIPTION
recoverdm This program will help you recover disks with bad sectors. You can recover files as well complete devices. In case if finds sec- tors which simply cannot be recoverd, it writes an empty sector to the output file and continues. If you're recovering a CD or a DVD and the program cannot read the sector in "normal mode", then the program will try to read the sector in "RAW mode" (without error-checking etc.). This toolkit also has a utility called 'mergebad': mergebad merges multiple images into one. This can be useful when you have, for example, multiple CD's with the same data which are all damaged. In such case, you can then first use recoverdm to retrieve the data from the damaged CD's into image-files and then combine them into one image with mergebad. OPTIONS
-t type is 1 for files, 10 for floppy disks and 40 for IDE disks (try -h for a complete list) -i filedevicein is the device or file you want to recover. -o fileout is the file where to write to. This file should not already exists. -l list This file will contain the offsets of the bad blocks as well as the size of the bad blocks. This file can be used together with the image with the mergebad utility. -n retries Number of retries before going on with next sector, defaults to 6. -r RAW read Number of retries while reading in RAW mode before going on with next sector, default to 6. -s rotation speed Speed of the CD-ROMDVD, defaults to 1. -h Gives the help message. SEE ALSO
gddrescue(1), dd_rescue(1), testdisk(1), gpart(1) AUTHOR
Folkert van Heusden <flok@xs4all.nl>, Home page is <http://www.vanheusden.com/recoverdm/> recoverdm Version 0.19 RECOVERDM(1)
All times are GMT -4. The time now is 03:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy