Unix/Linux 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 Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-30-2013
mukulverma2408 mukulverma2408 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 5 August 2015, 10:05 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 Unix and Linux 01-30-2013
Scrutinizer's Unix or Linux Image
Scrutinizer Scrutinizer is online now Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 3 September 2015, 12:05 AM EDT
Location: Amsterdam
Posts: 10,434
Thanks: 359
Thanked 2,769 Times in 2,475 Posts
extract? Just delete the quotes:

Code:
tr -d \' < file

Sponsored Links
    #3  
Old Unix and Linux 01-30-2013
Yoda's Unix or Linux Image
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 2 September 2015, 1:18 PM EDT
Location: Galactic Empire
Posts: 3,423
Thanks: 240
Thanked 1,225 Times in 1,151 Posts

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


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

    #4  
Old Unix and Linux 01-30-2013
mukulverma2408 mukulverma2408 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 5 August 2015, 10:05 AM EDT
Posts: 61
Thanks: 12
Thanked 2 Times in 2 Posts
Thanks bipinajith,

That's what i was looking for... Linux

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

Last edited by bakunin; 01-30-2013 at 05:53 PM..
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 12:29 AM.