[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: 18 December 2014, 10:03 AM EST
Location: Amsterdam
Posts: 9,690
Thanks: 300
Thanked 2,491 Times in 2,230 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: 18 December 2014, 11:38 AM EST
Location: Galactic Empire
Posts: 3,395
Thanks: 240
Thanked 1,211 Times in 1,137 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 06: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 01:17 AM
[Solved] deleting pattern based lines in sed pandeesh UNIX for Dummies Questions & Answers 0 12-03-2011 05:25 AM
[solved] remove pattern with sed a27wang Shell Programming and Scripting 8 09-17-2010 02: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 12:16 PM
Please help! Sed extract a pattern zhen Shell Programming and Scripting 11 09-18-2006 01:36 PM



All times are GMT -4. The time now is 02:18 PM.