LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-28-2011, 06:41 PM   #1
Senior Member
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,722

Rep: Reputation: 780Reputation: 780Reputation: 780Reputation: 780Reputation: 780Reputation: 780Reputation: 780
sed regex

hi, why isnt this working as i am expecting:
[schneidz@hyper temp]$ cat example.tmp
hello world
l33t h4x0rz
chun-li akuma
[schneidz@hyper temp]$ sed s/h*z/""/ example.tmp
hello world
l33t h4x0rz
chun-li akuma
i am expecting that the string h4x0rz does not come up in the output ?


Last edited by schneidz; 03-04-2012 at 05:53 PM.
Old 02-28-2011, 06:46 PM   #2
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
sed 's/h.*z//' example.tmp
The '*' means zero or more of the preceding character, which is an 'h' in your example. The '.' matches any character. Placing the search in single quotes prevents interpretation by the shell.
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with RegEx using sed citygrid Linux - Newbie 8 03-27-2010 09:17 PM
Help with sed regex homer_3 Linux - General 1 08-18-2009 01:57 PM
regex with sed to process file, need help on regex dwynter Linux - Newbie 5 08-31-2007 05:10 AM
sed regex question ShaqDiesel Programming 1 02-09-2007 07:24 PM
Help with Sed and regex cmfarley19 Programming 6 11-18-2004 01:09 PM

All times are GMT -5. The time now is 08:03 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration