Sponsored Content
Full Discussion: Help a newb with sed?
Top Forums Shell Programming and Scripting Help a newb with sed? Post 302354164 by phreezr on Thursday 17th of September 2009 09:39:13 AM
Old 09-17-2009
Thanks so much for your help, however neither of those work for me. I am running on Sun Solaris if that makes any differance and my sed is from 2005 it says. Tried gsed as well to no avail. Any suggestions?

Code:
mcs -p /usr/bin/sed
/usr/bin/sed:
@(#)SunOS 5.10 Generic January 2005

Code:
echo "variable_blah_STATUS _variable_blah_STATUS \ variable_blah_STATUS_ _variable_blah_STATUS_" 
| sed 's/\([^_]\)variable_blah_STATUS\([^_]\)/\1replace string\2/g'
variable_blah_STATUS _variable_blah_STATUS
variable_blah_STATUS_ _variable_blah_STATUS_

Code:
echo "variable_blah_STATUS _variable_blah_STATUS \ variable_blah_STATUS_ _variable_blah_STATUS_" 
| sed 's/\bvariable_blah_STATUS\b/replace string/g'
variable_blah_STATUS _variable_blah_STATUS
variable_blah_STATUS_ _variable_blah_STATUS_

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

The biggest newb ever...

Hi, all you unix people. I am a pretty advanced windows user, but I am curious about unix. Is there any reason I should attempt to acquire some form of unix for my home computer system? What sort of things is unix useful for? Unix is open source, right? Assuming that to be the case, I infer that... (3 Replies)
Discussion started by: BoneMalone
3 Replies

2. UNIX for Dummies Questions & Answers

100% newb - please help

I run windows 2000 right now. I want to learn how to use unix/linux. How do i go about installing Unix/Linux? What's the easiest version to install? Where can i get it? Is my Hardware Compatable? How do i partition my Hd? HELP!!!!!:confused: (6 Replies)
Discussion started by: Rawdawg
6 Replies

3. UNIX for Dummies Questions & Answers

help for a newb

ok i just installed FreeBSD 4.8 on a computer i had lying around and it was working ok but then when i tried to set up KDE's xdm (kdm) i think i must have configured the login manager wrong because i cant login through the kdm and therefore i can log in to BSD at all?! please can someone help me... (5 Replies)
Discussion started by: h3x
5 Replies

4. UNIX for Dummies Questions & Answers

Newb question

I don't even know if this should go here but I just would like to know what this means: d0e45878043844ffc41aac437e86b602 I know absolutely nothin' about UNIX, and I found this in a SQL table in a board I run. Someone please tell me what that is in "normal" mode. Pardon me for my... (4 Replies)
Discussion started by: daeglin
4 Replies

5. UNIX for Dummies Questions & Answers

Ok I'm a Newb, Please Help

I am wanting to download the Linux Program. When i go to download it I see several things to download. What do i download exactly? Then what do I do to install it. Also I have partitioned my hard drive to make way for Linux on the other part to play with it, will any problems arise from this? I... (3 Replies)
Discussion started by: Seeto
3 Replies

6. UNIX for Dummies Questions & Answers

Newb here....Someone spying on me?

Hey all. I'm brand spankin' new here to the board. I'm also a novice at Unix. I've been using it for about 1 year now but I haven't really expanded my abilities since I learned the basics. I am in school and I mainly just use Unix to submit stuff to assignment directories and use it to compile my... (3 Replies)
Discussion started by: andre2000
3 Replies

7. Shell Programming and Scripting

newb help needed

hi all, im working on a script that needs to read in a file, search for a string of text within that file, and if the string is found, do something. so i know i need to use an if-then statement, but how do i test for the existence of a string within the file? any help would be greatly appreciated. (6 Replies)
Discussion started by: mdlearnest
6 Replies

8. Shell Programming and Scripting

SED Newb - Range Rage!

Hi all First time poster long time lurker. I've been trying to get my head around SED but I think my beginner status is starting to prove too great a hindrence. I have nearly 100 CSS files that I need to modify in such a way that label, b, p .text{ some style stuff } would become b ,p... (9 Replies)
Discussion started by: GoneShootin
9 Replies

9. HP-UX

Newb Help, need to image one HD to another

Hello, I am totally new to Unix We have a piece of test equipment, three of them actually, that run HP-UX 9.0 from like 1994. We had backup tapes with procedures to load the OS and our test software, but the 16-track tapes are corrupt now. HP will not support it, they dont have it anymore,... (11 Replies)
Discussion started by: Newball80
11 Replies

10. Shell Programming and Scripting

newb at scripting how would I do this?

Hi guys. I have been lurking for quit some time attempting to learn on my own but I have reached an impasse. I need to extract specific details from from a text file that I get and parse it out into separate files with the name of each individual and the date it was proccess. Then within... (2 Replies)
Discussion started by: lostpacket
2 Replies
SHTOOL-SUBST.TMP(1)					      GNU Portable Shell Tool					       SHTOOL-SUBST.TMP(1)

NAME
shtool-subst - GNU shtool sed(1) substitution operations SYNOPSIS
shtool subst [-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning] [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup ext] [-e|--exec cmd] [-f|--file cmd-file] [file] [file ...] DESCRIPTION
This command applies one or more sed(1) substitution operations to stdin or any number of files. OPTIONS
The following command line options are available. -v, --verbose Display some processing information. -t, --trace Enable the output of the essential shell commands which are executed. -n, --nop No operation mode. Actual execution of the essential shell commands which would be executed is suppressed. -w, --warning Show warning on substitution operation resulting in no content change on every file. The default is to show a warning on substitution operations resulted in no content change on all files. -q, --quiet Suppress warning on substitution operation resulting in no content change. -s, --stealth Stealth operation. Preserve timestamp on file. -i, --interactive Enter interactive mode where the user has to approve each operation. -b, --backup ext Preserve backup of original file using file name extension ext. Default is to overwrite the original file. -e, --exec cmd Specify sed(1) command directly. -f, --file cmd-file Read sed(1) command from file. EXAMPLE
# shell script shtool subst -i -e 's;(c) ([0-9]*)-2000;(c) 1-2001;' *.[ch] # RPM spec-file %install shtool subst -v -n -e 's;^(prefix=).*;1 $RPM_BUILD_ROOT%{_prefix};g' -e 's;^(sysconfdir=).*;1 $RPM_BUILD_ROOT%{_prefix}/etc;g' `find . -name Makefile -print` make install HISTORY
The GNU shtool subst command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 2001 for GNU shtool. It was prompted by the need to have a uniform and convenient patching frontend to sed(1) operations in the OpenPKG package specifications. SEE ALSO
shtool(1), sed(1). 18-Jul-2008 shtool 2.0.8 SHTOOL-SUBST.TMP(1)
All times are GMT -4. The time now is 07:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy