Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Replace my perl with awk or sed

Shell Programming and Scripting


Reply    
 
Thread Tools Search this Thread Display Modes
    #8  
Old Unix and Linux 1 Week Ago
Scrutinizer's Unix or Linux Image
Scrutinizer Scrutinizer is online now Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 25 July 2017, 2:35 AM EDT
Location: Amsterdam
Posts: 11,488
Thanks: 494
Thanked 3,321 Times in 2,929 Posts
You are welcome. I made one correction in my post.. Added underscores which are also word characters..


Code:
-E               Use extended regular expressions
-o               Print only the matched (non-empty) parts of a matching line, 
                 with each such part on a separate output line
[[:alnum:].-]+   One or more alphanumeric character or underscore, dot or dash.
\.               A literal dot
(bin|exe)        Either the string "bin" or the string "exe"

Sponsored Links
    #9  
Old Unix and Linux 1 Week Ago
migurus migurus is offline
Registered User
 
Join Date: Sep 2008
Last Activity: 18 July 2017, 6:17 PM EDT
Location: US
Posts: 292
Thanks: 56
Thanked 33 Times in 31 Posts
Quote:
Originally Posted by invinzin21 View Post
I want something like..


Code:
# cat list_of|grep -E ".exe|bin"
aa.exe
aa.bin
bb.exe

older grep don't have -o option, in that case following your example just say

Code:
tr ' ' '\n' < list_of | grep -E '\.exe|\.bin'

Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Replace [|] in perl irudayaraj Shell Programming and Scripting 5 05-07-2012 10:37 AM
How replace -- character in perl gvk25 Shell Programming and Scripting 1 04-19-2012 01:34 AM
perl find and replace fettie Shell Programming and Scripting 1 09-15-2011 09:05 AM
perl - replace value Shanks Shell Programming and Scripting 5 06-23-2011 03:28 PM
Replace Perl Module name in all Perl scripts rahulrathod Shell Programming and Scripting 2 12-02-2005 12:00 AM



All times are GMT -4. The time now is 02:36 AM.