LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   sed command Problem (https://www.linuxquestions.org/questions/linux-newbie-8/sed-command-problem-621996/)

gizmo1007 02-18-2008 08:21 AM

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.

Vookimedlo 02-18-2008 08:30 AM

Code:

echo "ABSS12E1-out-qasyt.123.txt" | sed 's/-.*//'

chrism01 02-18-2008 06:17 PM

echo ABSS12E1-out-qasyt.123.txt|cut -d'-' -f1


All times are GMT -5. The time now is 05:48 PM.