The UNIX and Linux Forums  


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
removing characters dr_sabz UNIX for Dummies Questions & Answers 2 01-05-2009 06:02 PM
Removing ^D and ^H characters arsheshadri HP-UX 1 06-26-2008 09:01 AM
Removing Headers and a Column DerangedNick Shell Programming and Scripting 30 02-01-2008 05:02 PM
Help with removing characters like ^M chiru_h Shell Programming and Scripting 16 02-13-2007 10:07 AM
removing a column from list jxh461 Shell Programming and Scripting 3 10-09-2002 04:20 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-23-2009
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,330
If your file is tab-delimited:


Code:
sed 's/\(.*\)-[^\t]*\(.*\)/\1\2/' file

If your sed version doesn't support the "\t" as a tab character type <Ctrl-v><TAB> instead of \t.

Regards
  #2 (permalink)  
Old 03-23-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,789
awk -

Code:
awk '{print substr($1,1, length($1)-8), $2, $3}'  filename > newfilename

  #3 (permalink)  
Old 03-23-2009
e3r1ck_ETT e3r1ck_ETT is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 6
Getting closer. Thank you.

The output file is now two lines long though, reading:

Quote:
hsa-miR-517b 0 4.116
hsa-miR-886-5p-4395304
It looks like it performed the task on the first line, then somehow stopped and only printed the first column of the second line and all the other lines are gone. Perhaps it is something to do with delineating newlines in my file and the "awk" commands? (the file is tab-delimited txt saved from Text Editor in Mac OS).

(I'm working with biological data, I'm a reasonably intelligent person trying to work with large datasets but I am not a programmer. Solving these issues with programming instead of manually saves many, many, many hours for myself and coworkers so I appreciate the assistance).
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 01:36 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