[Solved] Extract a pattern using sed or cut | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

[Solved] Extract a pattern using sed or cut

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-30-2013
mukulverma2408 mukulverma2408 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 4 September 2014, 7:17 AM EDT
Posts: 61
Thanks: 12
Thanked 2 Times in 2 Posts
[Solved] Extract a pattern using sed or cut

Hi,
Need help to extract a pattern using sed or cut or any other means.

Input

Code:
'name1',1234567890
'name2',2222222222
'name3',3333333333

Expected output

Code:
name1,1234567890
name2,2222222222
name3,3333333333

Sponsored Links
    #2  
Old 01-30-2013
Scrutinizer's Avatar
Scrutinizer Scrutinizer is offline Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 20 October 2014, 5:32 PM EDT
Location: Amsterdam
Posts: 9,533
Thanks: 284
Thanked 2,419 Times in 2,169 Posts
extract? Just delete the quotes:

Code:
tr -d \' < file

Sponsored Links
    #3  
Old 01-30-2013
Yoda's Avatar
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 20 October 2014, 6:42 PM EDT
Location: Galactic Empire
Posts: 3,387
Thanks: 235
Thanked 1,209 Times in 1,135 Posts

Code:
sed 's/'\''//g' filename


Code:
awk '{gsub(/'\''/,"")}1' filename

    #4  
Old 01-30-2013
mukulverma2408 mukulverma2408 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 4 September 2014, 7:17 AM EDT
Posts: 61
Thanks: 12
Thanked 2 Times in 2 Posts
Thanks bipinajith,

That's what i was looking for...

Moderator's Comments:
edit by bakunin: changed thread title accordingly.

Last edited by bakunin; 01-30-2013 at 05:53 PM..
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sed or awk, cut, to extract specific data from line ocramas Shell Programming and Scripting 4 11-01-2012 12:17 AM
[Solved] deleting pattern based lines in sed pandeesh UNIX for Dummies Questions & Answers 0 12-03-2011 04:25 AM
[solved] remove pattern with sed a27wang Shell Programming and Scripting 8 09-17-2010 01:17 PM
sed: Find start of pattern and extract text to end of line, including the pattern TestTomas Shell Programming and Scripting 5 05-27-2009 11:16 AM
Please help! Sed extract a pattern zhen Shell Programming and Scripting 11 09-18-2006 12:36 PM



All times are GMT -4. The time now is 08:34 PM.