sed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Randomly firing SED


From: Tuc at Beach House
Subject: Randomly firing SED
Date: Sat, 29 Oct 2016 16:16:38 -0400

Hi,

I was testing a bash program with a sed I developed on Bash 3.2.25(1)-release / GNU sed version 4.1.5 on a system with Bash 4.2.46(1)-release / GNU sed version 4.2.1 . I noticed that the sed wasn't working (at all). I went back, and realized that it didn't seem to work 100% of the time on the old Bash/sed either. Whats worse, for the times it DID work, I couldn't replicate it doing it a second/third time.  Is there something seriously wrong with the commands I'm using or ??


#!/bin/bash

uuid="REPLACEMENT"
phrase="Name=\"test.png\"
filetype=\"who cares\"
filename=another.jpg;
Content-Type: image/jpeg; name=\"142819788418122.jpeg\"
another name for me"


echo "${phrase}"|sed "s/[nN]ame=\"?[^/]*.\([jJ][pP][gG]\|[pP][nN][gG]\|[gG][iI][fF]\|[jJ][pP][eE][gG]\)\"?/name=\"${uuid}.\1\"/g"

I'm expecting the results to be :

name="REPLACEMENT.png"
filetype="who cares"
filename="REPLACEMENT.jpg";
Content-Type: image/jpeg; name="REPLACEMENT.jpeg"
another name for me

Can anyone see why it would randomly NOT fire, and why it isn't doing what I expect?

Thank you, Tuc

reply via email to

[Prev in Thread] Current Thread [Next in Thread]