First, your problem: you can't use the same file for input and output (using > at least; using >> will work, but it will append the data which you also don't want).*
Second, sed takes a file as a final parameter, so you dont need cat | sed ...
* sed also has an in-place option, allowing you to use the same file for input and output. If you use the -i option, it will do this. The actual form (copying from the man page on my other comp) is -i[SUFFIX] where SUFFIX is optional, but when given it will copy the original file to fileSUFFIX, e.g. sed -i.bkup s/a/b/ somefile will create a file somefile.bkup without the changes.
Infarction
Posting Virtuoso
1,580 posts since May 2006
Reputation Points: 683
Solved Threads: 53
This might help.
if [ -L "$fullpath" ]; then #fullpath="`ls -l "$fullpath" | awk '{print $11}'`" fullpath=`ls -l "$fullpath" |sed -e 's/.* -> //' |sed -e 's/\*//'` fi dirname $fullpath } # Set the home if not already set
Next time please post your code more readably, or with a brief explanation of what it does. I can't imagine how it pertains to the OP's problem.
Infarction
Posting Virtuoso
1,580 posts since May 2006
Reputation Points: 683
Solved Threads: 53