Sponsored Content
Top Forums Shell Programming and Scripting Deleting multiple lines from file Post 302296167 by Yogesh Sawant on Tuesday 10th of March 2009 02:19:42 PM
Old 03-10-2009
in case your sed supports the in-line edit option:
Code:
for keyword in `cat str.txt`; do sed -i -e '/'$keyword'/d' list.txt; done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting Multiple Lines with sed

I am trying to use sed to delete multiple lines in a file. The problem is that I need to search for a certain line and then once found delete it plus the next 4 lines. For instance if I had a file that consisted of the following lines: #Data1.start ( (Database= data1) (Name = IPC)... (1 Reply)
Discussion started by: rambo15
1 Replies

2. Shell Programming and Scripting

Deleting last 2 lines from the file.

Hi I have a file & always I need to remove or delete last 2 lines from that file. So in a file if I have 10 lines then it should return me first 8 lines. Can someone help me? (4 Replies)
Discussion started by: videsh77
4 Replies

3. Shell Programming and Scripting

Deleting lines in a file

How do I delete all the lines after the line containing text ***DISCLOSURES*** . I want to delete this line too. Thank you (2 Replies)
Discussion started by: reachsamir
2 Replies

4. Shell Programming and Scripting

deleting lines from multiple text files

I have a directory full of text data files. Unfortunately I need to get rid of the 7th and 8th line from them all so that I can input them into a GIS application. I've used an awk script to do one at a time but due to the sheer number of files I need some kind of loop mechanism to automate... (3 Replies)
Discussion started by: vrms
3 Replies

5. UNIX for Dummies Questions & Answers

Deleting whole lines from a file

I have a file with 65 sets of 35 coordinates, and would like to isolate these coordinates so that I can easily copy the coordinates to another file. The problem is, I've got a 9 line header before each set of coordinates (so each set is 44 lines long). There are a zillion threads out there about... (3 Replies)
Discussion started by: red baron
3 Replies

6. UNIX for Advanced & Expert Users

Deleting lines from a file

How I can delete 100 lines anywhere in a file without opening a file and without renaming the file. (11 Replies)
Discussion started by: Nirgude07
11 Replies

7. Shell Programming and Scripting

pattern matching over multiple lines and deleting the first

I've got a longish log file with content such as Uplink traffic: Downlink traffic: I want to parse the log file and remove any line that contains the string "Uplink traffic:" at the beginning of the line, but only if the line following it beginnings with the string "Downlink traffic:" (in... (7 Replies)
Discussion started by: Yorkie99
7 Replies

8. UNIX for Dummies Questions & Answers

Deleting Multiple Lines in Hosts File

Hello all, I'm using the Bash shell on Solaris 8. Please can someone tell me how I can delete multiple lines in the hosts file? I have a list of hosts that I want to quickly delete in the hosts file, but I'm looking for a quicker way than using VI to delete the lines one by one. Regards,... (4 Replies)
Discussion started by: wthomas
4 Replies

9. Shell Programming and Scripting

Deleting Multiple Lines in a File1 using critera found from File 2

Hi Everyone! I would like ask if there's a better way I can delete multiple lines in a file1 by collecting all criteria from file2. file1: a b c d e f file2: a e f The expected value will be: b (3 Replies)
Discussion started by: zzavilz
3 Replies

10. Shell Programming and Scripting

Removing multiple lines from input file, if multiple lines match a pattern.

GM, I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed. I am assuming that sed, awk or even perl could do what I need. I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Discussion started by: jxfish2
7 Replies
Unicode::Escape(3pm)					User Contributed Perl Documentation				      Unicode::Escape(3pm)

NAME
Unicode::Escape - Escape and unescape Unicode characters other than ASCII VERSION
This document describes Unicode::Escape version 0.0.1 SYNOPSIS
# Escape Unicode charactors like '\u3042\u3043\u3044'. # JSON thinks No more Garble!! # case 1 use Unicode::Escape; my $escaped1 = Unicode::Escape::escape($str1, 'euc-jp'); # $str1 contains charactor that is not ASCII. $str1 is encoded by euc-jp. my $escaped2 = Unicode::Escape::escape($str2); # default is utf8 # $str2 contains charactor that is not ASCII. my $unescaped1 = Unicode::Escape::unescape($str3, 'shiftjis'); # $str3 contains escaped Unicode character. return value is encoded by shiftjis. my $unescaped2 = Unicode::Escape::unescape($str4); # default is utf8 # $str4 contains escaped Unicode character. # case 2 use Unicode::Escape qw(escape unescape); my $escaped1 = escape($str1, 'euc-jp'); # $str1 contains charactor that is not ASCII. $str1 is encoded by euc-jp. my $escaped2 = escape($str2); # default is utf8 # $str2 contains charactor that is not ASCII. my $unescaped1 = unescape($str3, 'shiftjis'); # $str3 contains escaped Unicode character. return value is encoded by shiftjis. my $unescaped2 = unescape($str4); # default is utf8 # $str4 contains escaped Unicode character. # case 3 use Unicode::Escape; my $escaper = Unicode::Escape->new($str, 'shiftjis'); # $str contains charactor that is not ASCII. $str is encoded by shiftjis.(default is utf8) my $escaped = $escaper->escape; # case 4 use Unicode::Escape; my $escaper = Unicode::Escape->new($str); # $str contains escaped Unicode character. my $unescaped1 = $escaper->unescape('shiftjis'); my $unescaped2 = $escaper->unescape; # default is utf8. DESCRIPTION
Escape and unescape Unicode characters other than ASCII. When the server response is javascript code, it is convenient. METHODS
new( $string[, $encode ] ) string Target string for escape or unescape. encode For instance, 'utf8', 'shiftjis', and 'euc-jp', etc. (See Encode) escape( $string[, $encode ] ) string Target string. This argument is unnecessary when called as object method. encode For instance, 'utf8', 'shiftjis', and 'euc-jp', etc. (See Encode) This argument is unnecessary when called as object method. unescape( $string[, $encode ] ) string Target string. This argument is unnecessary when called as object method. encode For instance, 'utf8', 'shiftjis', and 'euc-jp', etc. (See Encode) SEE ALSO
Unicode::String, Encode INCOMPATIBILITIES
None reported. BUGS AND LIMITATIONS
No bugs have been reported. Please report any bugs or feature requests to "bug-unicode-escape@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. AUTHOR
Hitoshi Amano "<seijro@gmail.com>" LICENCE AND COPYRIGHT
Copyright (c) 2006, Hitoshi Amano "<seijro@gmail.com>". All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. perl v5.12.3 2011-06-05 Unicode::Escape(3pm)
All times are GMT -4. The time now is 10:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy