Sponsored Content
Top Forums Shell Programming and Scripting delete lines in file matching a pattern Post 302300610 by stumpyuk on Tuesday 24th of March 2009 02:48:43 PM
Old 03-24-2009
delete lines in file matching a pattern

I have a text file, a sample of which is as follows:

HTML Code:
r/- * 0:        WINDOWS/Microsoft.NET/Framework/v2.0.50727/ASP.NETWebAdminFiles/Images/headerGRADIENT_Tall.gif
r/- * 0:        WINDOWS/SoftwareDistribution/Download/cf8ec753e88561d2ddb53e183dc05c3e/backoff.jpg
r/- * 0:        WINDOWS/SoftwareDistribution/Download/cf8ec753e88561d2ddb53e183dc05c3e/but3_up.gif
r/- * 0:        WINDOWS/SoftwareDistribution/Download/cf8ec753e88561d2ddb53e183dc05c3e/merlin.gif
r/- * 0:        WINDOWS/SoftwareDistribution/Download/cf8ec753e88561d2ddb53e183dc05c3e/newtop8.jpg
r/- * 0:        WINDOWS/SoftwareDistribution/Download/cf8ec753e88561d2ddb53e183dc05c3e/venice.jpg
r/r * 73487-128-3:      WINDOWS/SoftwareDistribution/Download/cf8ec753e88561d2ddb53e183dc05c3e/backup.jpg
r/r * 73493-128-3:      WINDOWS/SoftwareDistribution/Download/cf8ec7523e88561d2ddb53e183dc05c3e/btn1.gif
r/r * 73494-128-3:      WINDOWS/SoftwareDistribution/Download/cf8ec753e88561d2ddb53e183dc05c3e/btn2.gif
r/r * 73495-128-3:      WINDOWS/SoftwareDistribution/Download/cf8ec753e88561d2ddb53e183dc05c3e/btn3.gif
r/r * 73496-128-1:      WINDOWS/SoftwareDistribution/Download/cf8ec753e88561d2ddb53e183dc05c3e/bullet1.gif
How do I remove those lines whose 3rd column is "0"?

TIA.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading lines in a file matching a pattern

Hi, I need to redirect the lines in a file to a different file if the character starting from 2 to 6 in the line are numerical . Please let me know if anyone have any script to do this. Thanks, Ranjit (4 Replies)
Discussion started by: torenji
4 Replies

2. UNIX for Dummies Questions & Answers

How can you delete records in a file matching a pattern?

I am curious if the following can be done in a file in unix. Let's say I have a flat file with the following data AAA,12,2,,,, BBB,3,1,,,, CCC,,,,, DDD,2,,,,, SQQ,,,,, ASJ,,3,5 I only want to capture the data with values into a new file. If the data contains the pattern ,,,,, as in... (2 Replies)
Discussion started by: mode09
2 Replies

3. Shell Programming and Scripting

comment/delete a particular pattern starting from second line of the matching pattern

Hi, I have file 1.txt with following entries as shown: 0152364|134444|10.20.30.40|015236433 0233654|122555|10.20.30.50|023365433 ** ** ** In file 2.txt I have the following entries as shown: 0152364|134444|10.20.30.40|015236433 0233654|122555|10.20.30.50|023365433... (4 Replies)
Discussion started by: imas
4 Replies

4. Shell Programming and Scripting

Pattern matching in file and then display 10 lines above every time

hiii, i have to write a shell script like this---- i have a huge log file name abc.log .i have to search for a pattern name "pattern",it may occur 1000 times in the log file,every time it finds the pattern it should display the 10 lines above the pattern. I appericiate your help. (30 Replies)
Discussion started by: namishtiwari
30 Replies

5. Shell Programming and Scripting

Finding lines matching the Pattern and their previous lines in a file

Hi, I am trying to locate the occurences of certain pattern like 'Possible network disconnect' in a text file. I can get the actual lines matching the pttern using: grep -w 'Possible network disconnect' file_name. But I am more interested in getting the timing of these events which are... (7 Replies)
Discussion started by: sagarparadkar
7 Replies

6. Shell Programming and Scripting

how to delete lines from a file which starts with a specific pattern

I need to delete those lines from a file, which starts with 45. How to do it? (3 Replies)
Discussion started by: mady135
3 Replies

7. UNIX for Dummies Questions & Answers

FIND matching pattern of lines in a file

I need to search for two patterns in a file and find number of matching lines. find . -type f | xargs grep "DROP TABLE" | wc -l find . -type f | xargs grep "DROP SYNONYM" | wc -l The above code works. However I am looking at finding a commnd that will simplify as on a singe command... (2 Replies)
Discussion started by: Siva SQL
2 Replies

8. Shell Programming and Scripting

Want to print out lines with a matching pattern from file

Hi all, I want to search for strings in file1 that can be found in file2 and print out the whole line when matching pattern is found. I have used the below command, but this is not working for me, because it is writing out only the matching patterns from file2, not the whole line. fgrep -o... (2 Replies)
Discussion started by: MonikaB
2 Replies

9. Shell Programming and Scripting

Delete all lines from file matching a string

I wish to search and delete all lines in /app/Jenkins/deploy.txt having this filename string /app/Jenkins/file2.mrt as entry: I'm using : colon as delimiter in sed command as I'm dealing with file paths. Below is the command I was expecting to work. sed -i ":/app/Jenkins/file2.mrt:d"... (1 Reply)
Discussion started by: mohtashims
1 Replies

10. UNIX for Beginners Questions & Answers

How do delete certain lines alone which are matching with start and end string values in file?

Hi, In my previous post ( How to print lines from a files with specific start and end patterns and pick only the last lines? ), i have got a help to get the last select statement from a file, now i need to remove/exclude the output from main file: Input File format: SELECT ABCD, DEFGH,... (2 Replies)
Discussion started by: nani2019
2 Replies
JOSM(1) 						      General Commands Manual							   JOSM(1)

NAME
josm - Java OpenStreetMap Editor SYNOPSIS
josm DESCRIPTION
josm is an editor for OpenStreetMap written in Java 1.5. OpenStreetMap is a project aimed squarely at creating and providing free geographic data such as street maps to anyone who wants them. It allows you to view, edit and use geographical data in a collaborative way from anywhere on earth. The project was started because most maps you think of as free actually have legal or technical restrictions on their use, holding back people from using them in creative, pro- ductive or unexpected ways. OPTIONS
-h, -?, --help Show help --geometry=<width>x<height>(+|-)x(+|-)y Standard X geometry argument [--download=]minlat,minlon,maxlat,maxlon Download the bounding box [--download=]<url> Download the location at the url (with lat=x&lon=y&zoom=z) [--download=]<filename> Open file (as raw gps, if .gpx) --downloadgps=minlat,minlon,maxlat,maxlon Download the bounding box as raw gps --selection=<searchstring> Select with the given search --no-fullscreen Don't launch in fullscreen mode --reset-preferences Reset the preferences to the default --language=<language> Set the language ENVIRONMENT
JAVA_HOME Specify an alternate Java environment. JAVA_OPTS Specify Java options. For example, to use a HTTP proxy server with this program, set this environment variable to something like JAVA_OPTS="-Dhttp.proxyHost=yourProxyURL" before starting josm. SEE ALSO
josm-plugins(1). AUTHOR
josm was written by Immanuel Scholz. The current maintainer is Frederik Ramm. This manual page was written by Andreas Putzo <andreas@putzo.net>, for the Debian project (but may be used by others). September 8, 2007 JOSM(1)
All times are GMT -4. The time now is 04:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy