Sponsored Content
Top Forums Shell Programming and Scripting Sed or Awk to remove specific lines Post 302314502 by Franklin52 on Friday 8th of May 2009 01:10:31 PM
Old 05-08-2009
Ok, I have adjust the code, I didn't expect other lines with a semicolon at the end:

Code:
awk '/alter table/{f=1} /;$/ && f{f=0;next} !f'  file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to remove specific lines from a file

When restoring a file in my uninstall program I need to remove the lines I added to a file during the install. In between the file can be modified by the users. Assume file1 is as follow: xxx str2 xxxx ..... ...The Following lines containing str* have to be removed... xxx str1 xxxx xxx ... (17 Replies)
Discussion started by: bluemoon1
17 Replies

2. Shell Programming and Scripting

How to remove lines before and after with awk / sed ?

Hi guys, I need to remove the pattern (ID=180), one line before and four lines after. Thanks. (5 Replies)
Discussion started by: ashimada
5 Replies

3. Shell Programming and Scripting

Selecting specific 'id's from lines and columns using 'SED' or 'AWK'

Hello experts, I am new to this group and to 'SED' and 'AWK'. I have data (text file) with 5 columns (C_1-5) and 100s of lines (only 10 lines are shown below as an example). I have to find or select only the id numbers (C-1) of specific lines with '90' in the same line (of C_3) AND with '20' in... (6 Replies)
Discussion started by: kamskamu
6 Replies

4. Shell Programming and Scripting

Command to remove duplicate lines with perl,sed,awk

Input: hello hello hello hello monkey donkey hello hello drink dance drink Output should be: hello hello monkey donkey drink dance (9 Replies)
Discussion started by: cola
9 Replies

5. Shell Programming and Scripting

Summing over specific lines and replacing the lines with the sum using sed, awk

Hi friends, This is sed & awk type question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example ###start of input text file #### abc def ghi 1 2 3 4 kjld random... (3 Replies)
Discussion started by: kaaliakahn
3 Replies

6. Shell Programming and Scripting

Using sed, awk or perl to remove substring of all lines except the first

Greetings All, I would like to find all occurences of a pattern and delete a substring from the all matching lines EXCEPT the first. For example: 1234::group:user1,user2,user3,blah1,blah2,blah3 2222::othergroup:user9,user8 4444::othergroup2:user3,blah,blah,user1 1234::group3:user5,user1 ... (11 Replies)
Discussion started by: jacksolm
11 Replies

7. Shell Programming and Scripting

ksh sed - Extract specific lines with mulitple occurance of interesting lines

Data file example I look for primary and * to isolate the interesting slot number. slot=`sed '/^primary$/,/\*/!d' filename | tail -1 | sed s'/*//' | awk '{print $1" "$2}'` Now I want to get the Touch line for only the associate slot number, in this case, because the asterisk... (2 Replies)
Discussion started by: popeye
2 Replies

8. Shell Programming and Scripting

awk to remove lines in file if specific field matches

I am trying to remove lines in the target.txt file if $5 before the - in that file matches sorted_list. I have tried grep and awk. Thank you :). grep grep -v -F -f targets.bed sort_list grep -vFf sort_list targets awk awk -F, ' > FILENAME == ARGV {to_remove=1; next} > ! ($5 in... (2 Replies)
Discussion started by: cmccabe
2 Replies

9. Shell Programming and Scripting

sed or awk to remove specific column to one range

I need to remove specific column to one range source file 3 1 000123456 2 2 000123569 3 3 000123564 12 000123156 15 000125648 128 000125648 Output required 3 000123456 2 000123569 3 000123564 12 000123156 15 000125648 128 000125648 (6 Replies)
Discussion started by: ranjancom2000
6 Replies

10. UNIX for Beginners Questions & Answers

awk with sed to combine lines and remove specific odd # pattern from line

In the awk piped to sed below I am trying to format file by removing the odd xxxx_digits and whitespace after, then move the even xxxx_digit to the line above it and add a space between them. There may be multiple lines in file but they are in the same format. The Filename_ID line is the last line... (4 Replies)
Discussion started by: cmccabe
4 Replies
Wx::Perl::DataWalker(3pm)				User Contributed Perl Documentation				 Wx::Perl::DataWalker(3pm)

NAME
Wx::Perl::DataWalker - Perl extension for blah blah blah SYNOPSIS
# alternatively, see the dataWalker.pl script in this distribution! use Wx::Perl::DataWalker; my $data_to_browse = { # complex data structure. # Good test: \%:: }; package MyWalkerDialog; our @ISA = qw(Wx::App); sub OnInit { my $self = shift; my $frame = Wx::Perl::DataWalker->new( {data => $data_to_browse}, undef, -1, "dataWalker", ); $self->SetTopWindow($frame); $frame->Show(1); $frame->SetSize(500,500); return 1; } package main; my $app = MyWalkerDialog->new(); $app->MainLoop(); DESCRIPTION
"Wx::Perl::DataWalker" implements a "Wx::Frame" subclass that shows a relatively simple Perl data structure browser. After opening such a frame and supplying it with a reference to an essentially arbitrary data structure, you can visually browse it by double-clicking references. So far, there is no tree view but only a display of the current level of the data structure. You can traverse back up the structure with a back button. Optionally, "Wx::Perl::DataWalker" displays the (approximate!) size of the data structure using "Devel::Size". SEE ALSO
Wx, Devel::Size Padre::Plugin::DataWalker AUTHOR
Steffen Mueller, <smueller@cpan.org> COPYRIGHT AND LICENSE
Copyright (C) 2009 by Steffen Mueller This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8 or, at your option, any later version of Perl 5 you may have available. perl v5.10.0 2009-03-29 Wx::Perl::DataWalker(3pm)
All times are GMT -4. The time now is 11:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy