Sponsored Content
Top Forums Shell Programming and Scripting sed/awk to insert comment at defined line number Post 34851 by homefp on Monday 17th of March 2003 03:40:37 AM
Old 03-17-2003
this was just to finalize my need...
I was wondering if in a single sed command it would be possible to remove several lines starting from my label :
the following :
sed '/label/{N;N;d;}' < input > output
is only removing the second line after label, isn't it ?
But if I want to remove in one shot several lines, having only my label as reference, how should I write my sed command ? Smilie

In fact, I would like to replace the 3 lines described in my previous post :
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
with only one.Smilie

Thanks,
homefp
 

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
AUBIOTRACK(1)						      General Commands Manual						     AUBIOTRACK(1)

NAME
aubiotrack -- a command line tool for real time beat tracking SYNOPSIS
aubiotrack [options] [-i soundfile] DESCRIPTION
aubiotrack attempts to tap the beat and detect beat locations in musical sounds. When started with an input file argument (-i), aubiotrack print the beat locations in second detected in the file. When started without an input file argument (--input), aubiotrack creates jack input and output ports. When an input file is given, the results are given on the console. OPTIONS
This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. -i --input filein Run analysis on this audio file. Most common uncompressed formats are supported. -o --output fileout Save results in this file. The file will be created on the model of the input file. Results are marked by a short wood-block sam- ple. -O --onset mode The onset detection function to run. Available functions are complexdomain, hfc, phase, specdiff, energy, kl and mkl. By default, both Kullback Liebler (kl) and complex domain are used in parallel. -t --threshold value Set the threshold value for the onset peak picking. Typical values are within 0.001 and 0.900. Default is 0.1. Lower threshold values imply more onsets detected. Try 0.3 in case of over-detections. -j --jack Run in jack mode (default when started without input file) and creates a midi output. -v --verbose Show results on the console (default). -h --help Show summary of options. BUGS
For now the program has only been tested on audio signals sampled at 44.1 kHz. SEE ALSO
aubioonset(1) aubionotes(1) aubiocut(1) aubiopitch(1) AUTHOR
This manual page was written by Paul Brossier (piem@altern.org). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. AUBIOTRACK(1)
All times are GMT -4. The time now is 12:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy