Search Results

Search: Posts Made By: depakjan
1,779
Posted By Don Cragun
The sed utility isn't very good for arithmetic. ...
The sed utility isn't very good for arithmetic. Try something like:
awk '
BEGIN { FS = OFS = "|" }
NR==1 { print }
$1=="HD" { next }
$1=="TR" { $NF = count; t = $0; next }
{ print; count++...
1,779
Posted By RudiC
Adapting your approach, how about echo "HD|$(date...
Adapting your approach, how about echo "HD|$(date +%m%d%Y)|$(date +%m%d%Y)" > outfile
sed '1d;$d' file1 >> outfile
sed '1d;$d' file2 >> outfile
echo "TR|$(date +%m%d%Y)|$(date +%m%d%Y)|$(($(wc...
28,197
Posted By radoulov
Fixed: awk > _new_...
Fixed:

awk > _new_ '/decalre|begin|exception/, /;/ {
sub(/^\//, "\\/")
}1' infile &&
mv -- _new_ infile
28,197
Posted By alister
Indeed you did. I only went into detail about it...
Indeed you did. I only went into detail about it in case scottn or anyone else was interested in the most likely reason why it did not work with his sed.

That said, unless GNU sed behavior...
28,197
Posted By radoulov
awk '/decalre|begin/, /;/ { sub(/\//,...
awk '/decalre|begin/, /;/ {
sub(/\//, "\\/")
}1' infile

Or maybe:

awk '/decalre|begin|exception/, /;/ {
sub(/\//, "\\/")
}1' infile
28,197
Posted By Scott
Yes, it's the command I showed you, instead with...
Yes, it's the command I showed you, instead with single quotes, and two backslashes. More accurately put, it's radoulov's original solution with an extra backslash (and with $!s instead of 1s, since...
28,197
Posted By alister
That's because the replacement text in radoulov's...
That's because the replacement text in radoulov's solution is using an implementation-defined sequence. Since the slash is no longer the regular expression delimiter, preceding it with a backslash...
28,197
Posted By Scott
To "exclude the last line alone", you mean change...
To "exclude the last line alone", you mean change all lines except the last one?

Actually, radoulov's sed didn't work for me, strangely.


sed '$!s|^/|\\\/|' file
28,197
Posted By radoulov
Assuming GNU sed (given your example usage): ...
Assuming GNU sed (given your example usage):

sed -i '1s|^/|\/|' infile
5,812
Posted By otheus
pipe the command into xargs as follows: ...
pipe the command into xargs as follows:

ARCHIVE=somethingsomething.zip
sed ... | xargs zip a $ARCHIVE

Then use a MIME-compatible mail user agent (MUA) to send the zip file.

pine...
2,199
Posted By ctsgnb
YOURPATH=/tmp/whatever cat $(sed "s/:[^.]*/...
YOURPATH=/tmp/whatever
cat $(sed "s/:[^.]*/ /g;s:[.]/:$YOURPATH/:g" summary.txt) | mailx -s "your subject" user@domain.com
2,199
Posted By ctsgnb
Something like cat $(sed 's/:[^.]*/ /g'...
Something like
cat $(sed 's/:[^.]*/ /g' summary.txt) | mailx -s "your subject" user@domain.com
Showing results 1 to 12 of 12

 
All times are GMT -4. The time now is 03:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy