Sed bug in OS X?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Sed bug in OS X?
# 8  
Old 05-30-2003
According to the following links, sh is actually zsh. A problem occured for another person with this...

A problem with sed
zsh versus bash
# 9  
Old 05-30-2003
Sed bug in OS X?

I think I'm giving up on sed on OS X for now. I found a workaround with Perl (s/// works in Perl)

Next hurdle multi-line grep...

I find it really silly that multi-line grep is impossible using standard unix tools, but that's another matter

Ken
# 10  
Old 05-30-2003
Here's a quick run down of what my small awk script does with each line of output from egrep:

awk -F">" '{print $2}'

splits

<photoshop:CaptionWriter>this is where the caption writer goes</photoshop:CaptionWriter>

into pieces using > as a field separator:

<photoshop:CaptionWriter
this is where the caption writer goes</photoshop:CaptionWriter


and grabs the second piece ($2), which is

this is where the caption writer goes</photoshop:CaptionWriter

Then the second awk command awk -F"<" '{print $1}' takes that line and splits it into pieces using < as a field separator:

this is where the caption writer goes
/photoshop:CaptionWriter


and grabs the first piece ($1), giving you:

this is where the caption writer goes

Last edited by oombera; 06-04-2003 at 10:43 PM..
# 11  
Old 05-30-2003
Sed bug in OS X?

Cool!

With a slight modification to grab the field type out of the tag, this looks like it will work.

Thanks,

Ken
# 12  
Old 05-30-2003
It's true! If you just sit at a keyboard and keep punching random keys, it is possible to come up with a solution! Smilie

<output from egrep command> | sed -e 's/<*[[/a-zA-Z0-9:]*]*>//g'

Last edited by oombera; 06-04-2003 at 10:44 PM..
# 13  
Old 05-30-2003
Re: Sed bug in OS X?

Quote:
Originally posted by ktoz
I think I'm giving up on sed on OS X for now. I found a workaround with Perl (s/// works in Perl)

Next hurdle multi-line grep...

I find it really silly that multi-line grep is impossible using standard unix tools, but that's another matter

Ken
Great choice, using PERL. Many of us consider PERL a 'standard UNIX tool' , BTW. PERL is one of the finest pattern extraction languages in the known universe. SED and AWK are a bit 'dated' if you ask me (just my opinion). I'll take PERL and PHP any day.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Programming

Help in memcmp (it may be a bug)

Hello friends today i have created a program that is working fine . but when string becomes equal it does not work . /* String.h header series Comparison function memcmp = return 0 if string equal else return less or greater than value by comparing pointer first and pointer second ... (6 Replies)
Discussion started by: rink
6 Replies

2. Programming

is this a bug of g++?

Hello, Im using the g++(g++ Ubuntu/Linaro 4.4.4-14ubuntu5 4.4.5) and im trying to compile a small snippet code and got into an endless loop.I recompiled that in VS2010 under Windows 7 and the answer is as expected.so i wonder is this a bug of g++?here is my code. #include<iostream> using... (5 Replies)
Discussion started by: homeboy
5 Replies

3. UNIX for Dummies Questions & Answers

where's the bug?

#!/bin/bash if then #echo "infinite loop" exit 0 fi when I run this file I get the following error: ./test_infinite_loop: line 5: syntax error near unexpected token `fi' ./test_infinite_loop: line 5: `fi' :confused: (4 Replies)
Discussion started by: jon80
4 Replies

4. AIX

bug in 43 ???

xxxxserver# lsattr -El inet0 | grep 255.240.0.0,32.224.0.0,32.78.120.254 | grep '.40' route net,-hopcount,1,-netmask,255.240.0.0,32.224.0.0,32.78.120.254 How this is possible? (1 Reply)
Discussion started by: itik
1 Replies

5. Shell Programming and Scripting

Is it a bug ..?

Hi All, I am using Red Hat Linux on my servers. The problem that I am facing is, sometimes the /opt usage on the server shows used percentage as 100% , when actually it is simply 20%. When I reboot the system, it comes back to 20%.Is this a bug in the system or my settings have gone wrong... (1 Reply)
Discussion started by: nua7
1 Replies

6. UNIX for Advanced & Expert Users

logrotate bug?

I have been mailing myself logs for a while, but just ran into a problem because of a process that cannot HUP its log. (I realize thats why they implemented the "copytruncate" option in the first place) When I use logrotate with "copytruncate" and "compress" there is a problem. The "myScript"... (0 Replies)
Discussion started by: jjinno
0 Replies

7. UNIX for Dummies Questions & Answers

SED.EXE Bug?

Hi all, when using sed to replace a piece of text multiple times in a file something weird happens.If there is no carriage return after the last line in the file it deletes the line. Anyone know why ? Thanks Paul command line : sed -e "s/System.out.println/\/\/Commented out by us... (6 Replies)
Discussion started by: madcyril
6 Replies
Login or Register to Ask a Question