UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old December 2nd, 2004, 06:20 AM
pyramimi pyramimi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 1 pyramimi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
sed : help please & thanks :)

I've got this big file and I need to use the sed in one command to do the following ....
1) delete the first 3 lines
2) delete the last line
3) replace nulls or tabs with comma

... is this possible in one command? Thanks

Reply With Quote
  #2  
Old December 2nd, 2004, 06:34 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 33 m 4 sec
Reputation Power: 9
there a lot of books

sed '$d;1,3d;s/[0T]/,/g' input >output

T is litterally a tab char

Reply With Quote
  #3  
Old December 11th, 2004, 05:56 PM
roobaarb roobaarb is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 17 roobaarb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 8 m 46 sec
Reputation Power: 0
Quote:
Originally Posted by guggach
there a lot of books

sed '$d;1,3d;s/[0T]/,/g' input >output

T is litterally a tab char


That didn't do it exactly for me (cygwin in win2k) but:

sed '$d;1,3d;s/[\x00\t]/,/g' input >output

or

sed '$d;1,3d;s/[\x00T]/,/g' input >output

(where T is literally a TAB) does. I assume 0 was meant to be literally a null x'00' but it doesn't actually replace nulls when I try it.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > sed : help please & thanks :)


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway