Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Linux novice - Search and delete Post 302489606 by rdcwayx on Friday 21st of January 2011 12:01:33 AM
Old 01-21-2011
If you have more files, just add the file names one by one.

Code:
awk 'BEGIN{RS="";FS="\n"}
! a[$0]++ {b[$1]=b[$1]?b[$1] FS FS $0:$0} 
END {for ( i in b) print b[i] FS}' file1 file2 file3 file4 ...

or the efficient way

Code:
awk 'BEGIN{RS="";FS="\n"}
! a[$0]++ {b[$1]=b[$1]?b[$1] FS FS $0:$0} 
END {for ( i in b) print b[i] FS}' file*

 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search text and delete

After searching for a specified string, I would like to delete couple of rows from the file and continue searching. Basically, I would like to search through a text file that holds logs with date-time stamp in them and then clean up the file if the log entry is more than 2 days old. Example log... (0 Replies)
Discussion started by: new2shell
0 Replies

2. Shell Programming and Scripting

Search and delete

Gurus I have a CSV containing 60K records.Each row has 8 columns. On some rows ,for the 7th column ,i find word 'UnknownState(898914497)' repeated many times. e.g <N_HOST> <tcp> <*> <*> <*> <*> ... (1 Reply)
Discussion started by: ak835
1 Replies

3. Shell Programming and Scripting

Search and delete

A file(example viv.txt) contains a n number of rows like 1,2,3,4,5,6,7,8 11,22,33,44,55,66,77,88 1,3,9,7,8,5,2,6,4 Requirement: If number "5" exist in the sixth position then it should delete the whole line.like this it should check for all rows in a file(viv.txt) . please help on this. (5 Replies)
Discussion started by: katakamvivek
5 Replies
TEXTEROIDS(1)						      General Commands Manual						     TEXTEROIDS(1)

NAME
texteroids - test your mousing skills on spinning text SYNOPSIS
texteroids [ -display name ][ -fn font ][ -size size ][ text_string ] DESCRIPTION
texteroids spins the specified text string in a window. If you click on the text with the mouse, the string splits up into individual let- ters, each of which you may then click on. OPTIONS
-display name specifies the display on which to open a connection to the Display PostScript System. If no display is specified, the DISPLAY envi- ronment variable is used. -fn font specifies the name of the PostScript language font software to use. The default is Times-Italic. -size size specifies the size, in points, of the text. The default is 36. -debug specifies debugging mode. In debugging mode, all PostScript code sent to the server is printed out. text_string specifies the text to display. If the text has spaces it must be enclosed in quotation marks. The default text string is "Adobe". AUTHOR
Adobe Systems Incorporated NOTES
PostScript and Display PostScript are trademarks of Adobe Systems Incorporated which may be registered in certain jurisdictions. Copyright (c) 1990-1994 Adobe Systems Incorporated. All rights reserved. XFree86 Version 4.7.0 TEXTEROIDS(1)
All times are GMT -4. The time now is 04:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy