SED - editing file names (End of line problem?)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SED - editing file names (End of line problem?)
# 1  
Old 03-23-2008
Error SED - editing file names (End of line problem?)

For lists in sed, to say what to replace, is this correct: [$ .]

I am hoping that this would recognise that either a "." is present, or that the substitution happens at the end of the line.

For files with extensions [picture.jpg], my script works perfectly.

My problem is, files without extentions, i.e. [picture]. The script gives the following message for these cases: "picture and picture are identical".
# 2  
Old 03-23-2008
Please provide us with the actual sed script
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell quoting problem while editing a remote file using sed

value of i = solarisbox ssh $i "cat /etc/hosts | sed "s/$i\.local\.//" | sed "s/$i\./$i/" | sed "s/$i/$i.sol.com/" > /usr/users/chidori/edit_hosts"While running the above one liner its i am not able to make the changes and write it to the file /usr/users/chidori/edit_hosts . I know there is a... (2 Replies)
Discussion started by: chidori
2 Replies

2. Shell Programming and Scripting

SED and Solaris Append line to the end of File does not work

Hello, I have to add a new line at the end of a File on Solaris-System: I think my script should be right, because I evaluated it to other threads. However the script does not what I am expected it should do. My file might look like this: Line1 Line2 Line3 And my script could... (7 Replies)
Discussion started by: Timo_HR
7 Replies

3. Shell Programming and Scripting

help with sed adding line to end of file

sed '$a\ hello' books hi i am trying to use sed to append hello to the end of the file books, but for some reason i can't get it work. It keeps sayin command garbled. Anyone know what I'm doing wrong. this is in a ksh script as well. (3 Replies)
Discussion started by: bjhum33
3 Replies

4. Shell Programming and Scripting

Line/Variable Editing for Awk sed Cut

Hello, i have a file, i open the file and read the line, i want to get the first item in the csv file and also teh third+6 item and wirte it to a new csv file. only problem is that using echo it takes TOO LONG: please help a newbie. below is my code: WorkingDir=$1 FileName=`cut -d ',' -f... (2 Replies)
Discussion started by: limamichelle
2 Replies

5. Shell Programming and Scripting

problem in using sed command in editing a file

Hi all, I have a conf file, i want to update some entries in that conf file. Below is the code for that using a temporary file. sed '/workgroup=/ c\workgroup=Workgroup' /usr/local/netx.conf > /usr/local/netx.conf.tmp mv -f /usr/local/netx.conf.tmp /usr/local/netx.conf Sample contents of... (9 Replies)
Discussion started by: ranj14r
9 Replies

6. Shell Programming and Scripting

Getting file names which does not end with .log

Hi All, I have a directory in which all log files will be generated. Apart from the log files, there are a few other files also generated. I want the names of all files which does not end with .LOG. consider the dir has the following files I want only ebaf02012009.ERR file. Unix... (4 Replies)
Discussion started by: suresh_kb211
4 Replies

7. Shell Programming and Scripting

sed append "\n" to end of every line in file

I know it sounds simple, but I want to e-mail the last 6 lines of a log file, which I have tailed into logresults.txt. I'm using echo -e "Subject:server results\nFrom:server log <user@domain.com>\n"`cat logresults.txt` | sendmail -t user@domain.com which works, but the body of the e-mail has... (4 Replies)
Discussion started by: unclecameron
4 Replies

8. Shell Programming and Scripting

sed problem - last line of file deleted

Hi, I am simply trying to remove the header row from a file using sed, but I'm running into strange difficulties. It seems that in addition to removing the first line, this command is also removing the last line (or more specifically, clearing the last line, since the line is still counted... (4 Replies)
Discussion started by: erichpowell
4 Replies

9. UNIX for Dummies Questions & Answers

Editing multiple file names in one go

Hi there, I have a folder full of pdf's and I've run a compression on the to reduce the size, the output of the compress places a '-o' in the name of the file. Before 12345.pdf After 12345-o.pdf Now I've got around 50000 files that I need to change back to the previous name, is... (3 Replies)
Discussion started by: KeesH
3 Replies

10. UNIX for Advanced & Expert Users

Editing the end of the file without loading the entire file

hi! I am a newbee. I would really appreciate if you can answer the following question: I have a huge data file, 214MB with several coloumns. I need to delete the very last line of the file. Everything I know takes a lot of time to do it ( because I have to open the file in an editor or run a... (3 Replies)
Discussion started by: Garuda
3 Replies
Login or Register to Ask a Question