LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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-30-2016, 11:35 PM   #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-30-2016, 11:47 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

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


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:43 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
Open Source Consulting | Domain Registration