Sponsored Content
Top Forums Shell Programming and Scripting Sed Question 1. (Don't quite know how to use sed! Thanks) Post 302257321 by Yogesh Sawant on Wednesday 12th of November 2008 12:04:14 AM
Old 11-12-2008
smells like homework to me
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sed question

My data file look like tis field1:field2:field3:field4:field5 I wan to compare field 2 with 1 variable and if match change the details of it. How can i do it? I used to do it like tis: #in shell script checkSerial() { while do echo "  \c" ... (1 Reply)
Discussion started by: AkumaTay
1 Replies

2. UNIX for Dummies Questions & Answers

sed question

Hi, i'm in vi and am trying to globbaly changing some values. msisdn="4478....... for msisdn="078...... i've tried :s/msisdn="4478/msisdn="078/g but it complains it can't match the string. I'm thinking its the = and " thats the problem. Please help. HPUX 11i Cheers (3 Replies)
Discussion started by: nhatch
3 Replies

3. Shell Programming and Scripting

sed question

all, I am trying to use sed to read into a file and if a certain line exists (TRUSTHOSTKEY = YES), then I want to replace it with TRUSTHOSKEY = NO. My problem is that the line may exist as: trusthostkey=yes trusthostkey = yes TRUSTHOSTKEY = YES trusthostkey =yes It will however always... (1 Reply)
Discussion started by: hedrict
1 Replies

4. Shell Programming and Scripting

sed question

I'm wondering if you can do the following with sed or some other way. I would like to chang the character "*" in a string to "\052" inside of a script? i.e. string="text * text" #chang to string="text \052 text" (2 Replies)
Discussion started by: OldNo7
2 Replies

5. Shell Programming and Scripting

Use variable in sed don't work.

Hi all. I have a script as below: cutmth=`TZ=CST+2160 date +%b` export cutmth echo $cutmth >> date.log sed -n "/$cutmth/$p" alert_sbdev1.log > alert_summ.log My purpose is to run through the alert_sbdev1.log and find the 1st occurence of 'Jan' and send everything after that line to... (4 Replies)
Discussion started by: ahSher
4 Replies

6. Shell Programming and Scripting

Question on SED

Say for example I have a string as "/diggi/binary/d/e/f" I need the output as e ( The Second last “string”) . I want this using SED. Because using AWK its very easy. (4 Replies)
Discussion started by: Shell_Learner
4 Replies

7. Shell Programming and Scripting

grep? awk? sed? I don't know

Hi everyone! I have a file like this And I would like to find the Medium label when the value "last write" is "Jan 14" (it's could be another value like "jan 6") I really don't know what way to use to solve this problem... Thanks! (5 Replies)
Discussion started by: Castelior
5 Replies

8. UNIX for Dummies Questions & Answers

Using sed to change lines and add them if they don't exist..

I've googled the hell out of this, and in my quest to advance my knowledge and expertise in modifying phones to make them more awesome, I ended up here. I've found answers about patterns and whatnot that seem really complex for what I am trying to do, and basically it is this: if the line says... (2 Replies)
Discussion started by: Silentbtdeadly
2 Replies

9. UNIX for Beginners Questions & Answers

sed question

have some data and I'm attempting to manipulate with sed with not much success. Name John Davis Phone 5555555 Name Tim Watson Phone 1111111 would like to get that data to sort like this John Davis 5555555 Tim Watson 1111111 gotten sed to search for the value below 'Name'... (5 Replies)
Discussion started by: jimmyf
5 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 03:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy