LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-18-2008, 09:21 AM   #1
gizmo1007
LQ Newbie
 
Registered: Nov 2007
Location: Ireland
Posts: 3

Rep: Reputation: 0
sed command Problem


Hi,

I am trying to change a file name that is generated by the computer but cannot get it right using sed.
eg.
Currently I have a file named ABSS12E1-out-qasyt.123.txt

Using Sed 's[^S..E.]*/\1/' I can get this output -out-qasyt.123.txt

However what I want is ABSS12E1 Can anyone post the problem with my sed command.

Thanks for looking, if you can help great, it's been bugging me for days.
 
Old 02-18-2008, 09:30 AM   #2
Vookimedlo
Member
 
Registered: Jul 2004
Location: Czech Republic - Roudnice nad Labem
Distribution: Debian
Posts: 253

Rep: Reputation: 33
Code:
echo "ABSS12E1-out-qasyt.123.txt" | sed 's/-.*//'
 
Old 02-18-2008, 07:17 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
echo ABSS12E1-out-qasyt.123.txt|cut -d'-' -f1
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell scripting problem, sed command kamkos Linux - General 5 03-31-2007 10:39 PM
sed command Fond_of_Opensource Linux - Newbie 2 11-17-2006 09:11 AM
SED command problem vikasumit Linux - General 8 07-06-2006 01:33 PM
problem with sed command LFS 6.0 obsidianblackha Linux From Scratch 6 12-07-2004 11:31 AM
bash Problem with "sed" command blubbfish Linux - Newbie 3 06-01-2004 11:14 AM


All times are GMT -5. The time now is 03:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration