Sponsored Content
Top Forums Shell Programming and Scripting How to remove lines containing strings Post 302535962 by pinpe on Sunday 3rd of July 2011 10:51:27 AM
Old 07-03-2011
How to remove lines containing strings

Hi Guys,

I need some script in removing lines containing strings like ",, ," and "rows". Retain only numbers as the output. See below for the input and output file.


INPUT FILE:
Code:
9817
9832
6285
6312
6313
6318
,,  ,
6329
7078
7098
7130
7959
7983
1253
1254
1257
,,  ,
,rows,selected
,,  ,





DESIRED OUTPUT FILE:
Code:
9817
9832
6285
6312
6313
6318
6329
7078
7098
7130
7959
7983
1253
1254
1257


Thanks in advance.


Br,
Pinpe
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using AWK see the upper lines and lower lines of the strings??

Hi experts, You cool guys already given me the awk script below- awk '/9366109380/,printed==5 { ++printed; print; }' 2008-09-14.0.log Morever, i have one more things- when i awk 9366109380, i can also see the Upper 3 lines as well as below 5 lines of that string. Line 1.... (3 Replies)
Discussion started by: thepurple
3 Replies

2. Shell Programming and Scripting

Remove matching lines with list of strings

Hi, HP-UX gxxxxxxxc B.11.23 U ia64 3717505098 unlimited-user license I have a file with below pipe separated field values: xxx|xxx|abcd|xxx|xxx|xx xxx|xxx|abcd#123|xxx|xxx|xx xxx|xxx|abcd#345|xxx|xxx|xx xxx|xxx|pqrs|xxx|xxx|xx xxx|xxx|pqrs#123|xxx|xxx|xx The third field has values like... (6 Replies)
Discussion started by: Nanu_Manju
6 Replies

3. Shell Programming and Scripting

different take on common ?: search for two strings and remove lines between them

Thank you for assisting, I've got a partial solution just needs a tweak. Hulk-BASH$ cat somefile.txt oh there is some stuff here some more stuff here START_LABEL stuff I want more stuff I want END_LABEL other stuff here too and even more stuff here too Hulk-BASH$ Hulk-BASH$ sed... (8 Replies)
Discussion started by: laser
8 Replies

4. Shell Programming and Scripting

Grep and delete lines except the lines with strings

Hi I am writing a script which should read a file and search for certain strings 'approved' or 'removed' and retain only those lines that contain the above strings. Ex: file name 'test' test: approved package waiting for approval package disapproved package removed package approved... (14 Replies)
Discussion started by: vj8436
14 Replies

5. Shell Programming and Scripting

Removing empty lines(space) between two lines containing strings

Hi, Please provide shell script to Remove empty lines(space) between two lines containing strings in a file. Input File : A1/EXT "BAP_BSC6/07B/00" 844 090602 1605 RXOCF-465 PDTR11 1 SITE ON BATTERY A2/EXT... (3 Replies)
Discussion started by: sudhakaryadav
3 Replies

6. Shell Programming and Scripting

How to remove unwanted strings?

Hi Guys, Can someone give me a hand on how I can remove unwanted strings like "<Number>" and "</Number>" and retain only the numbers from the input file below. INPUT FILE: <Number>10050000</Number> <Number>1001340001</Number> <Number>1001750002</Number> <Number>100750003</Number>... (8 Replies)
Discussion started by: pinpe
8 Replies

7. Shell Programming and Scripting

Delete lines in file containing duplicate strings, keeping longer strings

The question is not as simple as the title... I have a file, it looks like this <string name="string1">RZ-LED</string> <string name="string2">2.0</string> <string name="string2">Version 2.0</string> <string name="string3">BP</string> I would like to check for duplicate entries of... (11 Replies)
Discussion started by: raidzero
11 Replies

8. Shell Programming and Scripting

Compare one files with strings from another + remove lines

Have two files and want to compare the content of file1 with file2. When matched remove the line. awk 'NR==FNR {b; next} !(b in $0)' file1 file2file1 1. if match 2. removefile2 1. this line has to be removed if match 2. this line has a match, remove 3. this line has no match, no removingThe... (3 Replies)
Discussion started by: sdf
3 Replies

9. Shell Programming and Scripting

Remove lines containing 2 or more duplicate strings

Within my text file i have several thousand lines of text with some lines containing duplicate strings/words. I would like to entirely remove those lines which contain the duplicate strings. Eg; One and a Two Unix.com is the Best This as a Line Line Example duplicate sentence with the word... (22 Replies)
Discussion started by: martinsmith
22 Replies

10. Shell Programming and Scripting

awk to remove lines that do not start with digit and combine line or lines

I have been searching and trying to come up with an awk that will perform the following on a converted text file (original is a pdf). 1. Since the first two lines are (begin with) text they are removed 2. if $1 is a number then all text is merged (combined) into one line until the next... (3 Replies)
Discussion started by: cmccabe
3 Replies
7(16 December 2012)													       7(16 December 2012)

NAME
sndstat - Open Sound System status device DESCRIPTION
/dev/sndstat is a text formatted device special file that returns information about available (OSS) sound devices. This device file is obsolete and the ossinfo(1) utility should be used instead. Notice that the device numbering used in this file is different that the official numbering used by ossinfo(1) and some other utilities. /dev/sndstat uses device numbers that match the "legacy" /dev/dspN, /dev/midiN and /dev/mixerN device files. Application programs should not use /dev/sndstat to obtain information about the sound devices. The format of this file may change in the future and /dev/sndstat may even be removed from OSS in distant future. OSS 4.0 and later has an ioctl interface for getting detailed and reliable information about the devices. AUDIO USAGE HISTORY
/dev/sndstat reports some history information about previously run audio applications. This section is a debugging aid for application developers and it will be moved to the ossinfo program in the future. For example: History: /dev/oss/hdaudio0/pcm0.10: pid 6326 cmd 'error_test' OUT Play events:01009:2 Rec events:01002:0 /dev/oss/hdaudio0/pcm0.10: pid 6329 cmd 'mpg123' OUT /dev/oss/hdaudio0/pcm0.10: pid 6329 cmd 'mpg123' OUT /dev/oss/hdaudio0/pcm0.10: pid 6329 cmd 'mpg123' OUT Each line will show the the device name, PID and name of the application (if known) and access mode (IN and/or OUT). There may also be additional info about buffer underruns/overruns and other recording and playback related events. Each Play and rec events consist of 5-6 digit event code and a parameter separated by a colon. A list of defined event codes and their explanations can be found from http://manuals.opensound.com/developer/oss_error_codes.html. Purpose of these events is to inform applica- tion developers by potential problems in their code. COMPATIBILITY
/dev/sndstat has been available in all OSS versions. However in OSS 4.0 and later this device file should only be used by applications written for earlier OSS versions. OPTIONS
None PROGRAMMING INFORMATION
Some applications use /dev/sndstat to find the audio devices available in the system. This method is no longer recommended. Applications should use the SNDCTL_AUDIOINFO(2) ioctl call to find the devices. SEE ALSO
o dsp(7) - Audio device files o mixer(7) - Mixer (control panel) device files o midi(7) - MIDI device files FILES
/dev/sndstat AUTHOR
4Front Technologies OSS Devices 7(16 December 2012)
All times are GMT -4. The time now is 03:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy