The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need to serach if a new line character exists on the last line in a file sunilbm78 UNIX for Dummies Questions & Answers 10 02-29-2008 02:15 PM
serach and replace file name in the path in a remote xml file kiranreddy1215 Shell Programming and Scripting 1 11-12-2007 11:31 AM
Serach and delete kkm_job UNIX for Advanced & Expert Users 3 10-25-2006 01:55 PM
Case-insensitive serach with awk acheepi Shell Programming and Scripting 4 07-15-2005 05:58 PM
text serach in unknown file ted UNIX for Advanced & Expert Users 11 10-23-2003 03:20 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-28-2007
mohan705 mohan705 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 134
serach file using awk

Hi,
I was able to print lines when search for specific string using awk but i want to print when search for two different strings using awk instead of doing two times (Print lines only contain "Insert Records and Insert into" not between lines)

Ex:
awk '/Insert Records./' a4.log

It displaying all lines strat with Insert Records
ex:

Insert records total:4
Insert records total:6
Insert records total:8

awk '/Insert into./' a4.log
ex:
Insert into t1
Insert into t2
Insert into t3

Thanks inadvance
Mohan
  #2 (permalink)  
Old 08-28-2007
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
Code:
awk '/firstpattern/ || /secondpattern/ { print }' filename
  #3 (permalink)  
Old 08-28-2007
mohan705 mohan705 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 134
Thanks for your reply.

Thanks ,
Mohan
  #4 (permalink)  
Old 08-28-2007
mohan705 mohan705 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 134
Replace string in multiple files

Hi,

One more question ,I Have 10 files ,I need replace $INPUT_LOCATION with $INPUT_LOCATION_upd .using sed command do it single file .How can change all files in single shot

sed -s'/old/new' file1

Thanks,
Mohan
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:21 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0