SED script needs tweak


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SED script needs tweak
# 1  
Old 08-13-2011
SED script needs tweak

I have a SED script that has worked for years, but broke today due to a new variable in a remote file. This is the part of the script that now won't work:

sed "s|/directory/overview.gif|/directory/img/overview2.gif|g" | \

The path /directory/overview.gif is no longer static as it had been for years. The path remains the same - but the gif file does not. It now is /directory/1234567890.gif - except that 10 digit number changes every few hours.

What I want SED to accomplish is to change the path /directory/whatevernumber.gif to /directory/img/overview2.gif

My initial attempt was:

sed "s|/directory/*.gif|/directory/img/overview2.gif|g" | \

But no success. I'm obviously not a frequent SED coder. Is there a simple solution?
# 2  
Old 08-13-2011
Hi,

Try with
Code:
.*

or more accurate
Code:
[0-9]*

Regards,
Birei
This User Gave Thanks to birei For This Post:
# 3  
Old 08-13-2011
Birei,

Thank you for a wonderfully simple fix. The .* solution works great.

Life is calmer again....

Thank you again,

Keith
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Tar.gz help - Need to tweak

Hi Guys - I need help tweaking my tar.gz process. Currently, I compress all files in a directory, in which the parent directory is included in that. I only want to compress the "*.txt" files in the follow process: tar -zcvf ${_ESSB_TAR_PATH}/Essbase_Exports_${_DATETIMESTAMP}.tar.gz -C /... (3 Replies)
Discussion started by: SIMMS7400
3 Replies

2. Shell Programming and Scripting

Tweak python program to give result in json

Hi , Below is the script which prints result in json but when i validate it has some tab or extra space issues. JSON result { "data": } This is the line I tweaked. Please advise. print "\t{", "\"{#NAME}\":\""+container+hn+"\"}" #!/usr/bin/env python # (2 Replies)
Discussion started by: ashokvpp
2 Replies

3. Shell Programming and Scripting

Perl find command tweak

i use the following command to find files that were recently updated within the last hour: perl -MFile::Find -le' find { wanted => sub { -f and 3600 / 86400 >= -M and print $File::Find::name; } }, shift' /var/app/mydata/ this command works well. however, it seems to also search directories... (1 Reply)
Discussion started by: SkySmart
1 Replies

4. Shell Programming and Scripting

perl line needing a tweak

Hi Folks, I have a perl line that looks like this and it works fine as is, but I need it to expand a bid further. perl -aF, -ne 'printf "conf zone %2\$s delete host %s,,,$F\n",split/\./,$F,2 if /^hostrecord/ &&/\b10\.8\.(|1)\.\d/' hosts.csv this code the way it is does this 10.8.3.0... (10 Replies)
Discussion started by: richsark
10 Replies

5. UNIX Desktop Questions & Answers

Terminal title bar tweak discrepancy problem in Cygwin/X

Code for the tweak (not my fave 'running process' but the more popular 'working directory') : case "$TERM" in xterm*|rxvt*|rxvt-unicode*) PROMPT_COMMAND='echo -e "\033]0;$TERM: ${PWD}\007"' ;; *) ;; esac Where it works: rxvt (the one I run 'rootless' outside of ... (0 Replies)
Discussion started by: SilversleevesX
0 Replies

6. Shell Programming and Scripting

How to tweak up

I have a script like this: while read abbrev; do sed 's/'$(echo "$abbrev" | tr "" "")'/'"$abbrev"'/g' 'output_rgt.'$$ >'tmp.'$$ mv 'tmp.'$$ 'output_rgt.'$$ done<'dict.shortcuts.'$$ And I don't know how to leave "mv" out. ('dict.shortcuts.'$$ may be... (14 Replies)
Discussion started by: MartyIX
14 Replies
Login or Register to Ask a Question