The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk program to select a portion of a line anju Shell Programming and Scripting 3 01-11-2008 06:33 AM
Backspace erasing the prompt videsh77 UNIX for Dummies Questions & Answers 4 01-23-2007 07:38 AM
Delete Portion of a file sameersbn High Level Programming 2 01-20-2007 12:16 AM
erasing portion of line with sed (only once) gammaman UNIX for Dummies Questions & Answers 1 07-14-2005 08:40 PM
erasing old files lsquillacioti UNIX for Dummies Questions & Answers 1 04-10-2001 02:45 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-06-2005
gammaman gammaman is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 19
erasing portion of line with sed

hi,

I'm trying to use sed to erase everything, and including the ending parenthesis. For example:
input: blah blah blah (12355)this is what i want.
output: this is what i want.

how would i do this?
i found an example online that does the opposite:
sed \"s|test.*||g\" file1 > file2";

but when i reverse it, it doesn't do anything. Any ideas?

thanks,
gammaman
  #2 (permalink)  
Old 07-06-2005
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
echo "blah blah blah (12355)this is what i want" | sed 's/.*)\(.*\)$/\1/'

Cheers
ZB
  #3 (permalink)  
Old 07-07-2005
gammaman gammaman is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 19
Quote:
Originally Posted by zazzybob
echo "blah blah blah (12355)this is what i want" | sed 's/.*)\(.*\)$/\1/'

Cheers
ZB
thanks! this helped a lot
  #4 (permalink)  
Old 07-07-2005
gammaman gammaman is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 19
erasing blank lines using sed

do you also know how I can erase only the blank lines of a huge file?

I was thinking something similar to this, but this might also erase the blank spaces on lines with words?
sed "s|*[]*||g" huge_file;

thanks,
gammaman
  #5 (permalink)  
Old 07-07-2005
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,206
Code:
sed '/^[    ]*$/d' huge_file
[ ] contains one space and one TAB character.

However perl would probably be a better tools to do this to a hugh file.
  #6 (permalink)  
Old 07-10-2005
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
to remove all the blank lines, you could also try ...

grep -v "^$" huge_file
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:56 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0