LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-31-2016, 12:35 AM   #1
Mike_Brown
Member
 
Registered: May 2015
Posts: 37

Rep: Reputation: Disabled
awk: how to match the character start with and end with


I am using awk. I have several names like

Code:
rs123123789_G    rs9888_A     rs23789_GA rs23789_GASDFAS
I want to find the name start with rs and end with single character in awk (rs123123789_G, rs9888_A). I tried use

Code:
~/^rs[0-9]+[A-Z]$/
But it does not work.
 
Old 03-31-2016, 12:47 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,840

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
Including an underscore in your regex might help.
 
1 members found this post helpful.
  


Reply


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
[SOLVED] Search for 2 strings between a start and end range in awk dazdaz Programming 2 03-15-2013 09:53 AM
[SOLVED] AWK: match multiple strings in the file, print 1 when match and 0 when not cristalp Programming 12 11-15-2011 11:18 AM
awk regexp for one character match nemobluesix Linux - General 7 02-16-2009 11:50 PM
How can I strip white space from the start and end of fields using awk? jonnymorris Programming 7 10-02-2008 11:52 PM
AWK: print field to end, and character count? ridertech Linux - Newbie 1 05-07-2004 06:07 PM


All times are GMT -5. The time now is 12:46 PM.

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