Sorry about the title. I'm assuming I want sed anyway...
Here's the deal:
I have hundreds of files in a folder and they all are named with the same format.
$NAME-$VERSION-$ARCH-$BUILD
This is Slackwares' /var/log/packages directory BTW...
$BUILD is what I'm focusing on. It could be just "1" or it could be "1foo" or it could be "1foo357" or "1foo357bar"
I'm trying to isolate just the "1" regardless of what comes after it. I came to the conclusion that just identifying the last hyphen and then grabbing the very next number would be the easiest way.
This is what worked great until I started adding custom build tags like foo and foo357:
so if $build = 1foo357bar, then the above gives me "r"... The number I want will ALWAYS be after the last hyphen. There is a small chance that the number could reach double digits but it would be rare.
Any ideas? Thanks much for your help. I'm really stumped for some reason.
Hi ,
I have a question. How do I replace 2 words in one line like this
IN CLO07 INDEX IN CLOIX07
to
IN CLO07_S02 INDEX IN CLOIX07_S02
But one thing to remember is that there are lots of words like CLODM001 .
So the only matching pattern is "IN CLO"
sample file... (4 Replies)
how can I find cpu usage memory usage swap usage and
I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times
my final destination is monitor process
logical volume usage above X % and number of Logical voluage above
can I not to... (3 Replies)
I'd like to extract the temps from the following command via a series of sed statements but the actual syntax is beyond me.
$ nc localhost 7634 ... (2 Replies)
Hi,
I want to read a command value and replace the command value in another file.
Anybody know how to write it???
For example:
File A:
Command1 = test
File B:
Command1 =
Command2 =
Command3 =
I want to write a shell script to read content from File A and replace Command1... (3 Replies)
Friends,
I came across a wierd scenario while using sed. When I use the below cmd sequence at OS prompt it works fine:
sed 's/# TMOUT=120/TMOUT=900/g' /etc/profile > /etc/profile.011211
However when I use the same in a script it throws the following error:
==Error==
sed: 0602-404... (4 Replies)
Gurus,
I am trying to display a match (single character) from beginning of the line in a file using a variable.
I tried using sed ... not sure where am doing it wrong...
sed -n "/^\$variable/p" FileName.shor
sed -n "/^\${variable}/p" FileName.shBoth of the above are not working.....Thanks... (4 Replies)
Hi,
Can anyone let me know the sed command usage
requirement:
sed 's/standard/standard_and/' <new.txt>new.txt
here it needs to search for the pattern "standard" in the file new.txt and it should replace as "standard_and" in the same file new.txt
Note: new.txt is having a separator... (8 Replies)