Strip one of two Patch references


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Strip one of two Patch references
# 1  
Old 02-18-2011
Strip one of two Patch references

This log file is wacky.

the syntax puts this in the Installation line:
Installation PATCH75682.91 of PATCH75681 complete
Installation PATCH76537.91 of PATCH76537 complete
Installation PATCH92217.91 of PATCH92217 complete

So I'm looking for a sed 's///' to remove the first PATCHxxxx occurance,
but if I try
Code:
sed 's/PATCH[0-9]//' infile > outfile

I still have xxxx.xx in the line. Do I need [0-9] for each digit?
# 2  
Old 02-18-2011
See if this works for you:
Code:
sed 's/PATCH.* of//' input_file

# 3  
Old 02-18-2011
Almost, it's cutting out the 'of' and some lines ref a preview mode before the 'of'.
# 4  
Old 02-18-2011
the above suggestion work perfecly:

issue with your command was a missing * and . in search pattern

Your code should look like
Quote:
sed 's/PATCH[0-9.]*//' infile > outfile
# 5  
Old 02-18-2011
What about this:
Code:
sed 's/ PATCH.* of/ of/1' input_file

dba_frog, next time, specify the desired output.
# 6  
Old 02-18-2011
My apologies, I didn't see the preview in there until reviewing the output

but, this worked
Code:
sed 's/PATCH[0-9.]*//' infile > outfile

and i was very close, just needed a little tweaking.

Last edited by dba_frog; 02-18-2011 at 12:22 PM..
# 7  
Old 02-19-2011
Code:
awk '/PATCH/{$2=""}1' infile

Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sort references

I have the following entries and want to perform a sort. Each entry is separated by a newline, however each line should not be considired seperate. Maybe an awk program or similar, or a small script. Anderson, E.R., Duvall, T.L., Jr., and Jefferies, S.M., 1990. Modelling of Solar... (6 Replies)
Discussion started by: kristinu
6 Replies

2. Shell Programming and Scripting

awk Programming references

Hi all, I am new and I am very interested in Awk programming language and would like to know what references or books that really worked for you that was clear, concise with simple examples. much appreciated in advance. (1 Reply)
Discussion started by: Apollo
1 Replies

3. Shell Programming and Scripting

Perl References/Dereferences

Can someone explain where can we actually used print $var->; or print $$var When does the -> becomes necessary and when its optional. (1 Reply)
Discussion started by: dinjo_jo
1 Replies

4. Programming

Wanted: References on Sockets and Threads for C

I'm looking at http://www.opengroup.org/pubs/online/7908799/xsh/pthread.h.html trying to understand mutexs and semaphores. Windows makes a distinction between the two. Is a mutex and semaphore different in unix land? Is there a tutorial on threading in unix somewhere? I'm also looking at... (4 Replies)
Discussion started by: siegfried
4 Replies

5. IP Networking

Patch-o-matic (patch for iptable) for linux2.4.08 & iptable1.2.7a

Hello friends I'm running Redhat 9.0 with linux kernel 2.4.20-8 & have iptables version 1.2.7a & encountering a problem that I narrate down. I need to apply patch to my iptable and netfilter for connection tracking and load balancing that are available in patch-o-matic distribution by netfilter.... (0 Replies)
Discussion started by: Rakesh Ranjan
0 Replies

6. UNIX for Advanced & Expert Users

Compound indirect variable references

Using bash, I'm trying to read a .properties file (name=value pairs), assigning an indirect variable reference for each line in the file. The trick is that a property's value string may contain the name of a property that occurred earlier in the file, and I want the name of the 1st property to... (5 Replies)
Discussion started by: tkrussel
5 Replies

7. AIX

AIX References?

Would like to know where or what is available to quickly develope my AIX skills. Training budget limited.. Thanks and have a great day! (1 Reply)
Discussion started by: lmwical
1 Replies
Login or Register to Ask a Question