Computing.Net > Forums > Unix > Search file & add string after that

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Search file & add string after that

Reply to Message Icon

Name: khanati
Date: June 17, 2004 at 11:53:35 Pacific
OS: UNIX
CPU/Ram: 256
Comment:

i have a Makefile:

# This is a template for all makefile.

#Set the list of files to be delete by clean:
CLEAN_TARGETS += $(ALL_LIBRARIES)

#Set the list of target to make while testing
TEST_TARGETS += mytest

# adjust the location of Rules.mk as needed.
include ../../Rules.mk

mytest:
$(CMDECHO) echo mytest > /dev/null

testWithFailure:
ifeq ($(FAIL),)
$(WarnFailTest)
endif


I want to add comething from the command line in front of TEST_TARGETS +=

One more thing.

there is 'mytest' after TEST_TARGETS +=

i need to delete that in one option and i want to retain that in another, for example if i get 'test1' from command line it should be appeneded so that it becomes
TEST_TARGETS += test1 mytest

How can i do that?



Sponsored Link
Ads by Google

Response Number 1
Name: Jc
Date: June 17, 2004 at 20:59:06 Pacific
Reply:

________
script.sed:
--------------
sed 's/TEST_TARGETS +=/TEST_TARGETS +='$1'/g' Makefile

Jc


0

Response Number 2
Name: khanati
Date: June 18, 2004 at 08:34:35 Pacific
Reply:

Hey:

i have following content in file...

TARGETS += TAR1 TAR1TAR2 TAR3

Now i have to check whether TAR1 exists or not. Its easy to find but in this case it gives two occurences. I need independent (TAR1 by itself, as independent string). It shouldn't consider TAR1 in TAR1TAR2 One more thing...this can be done by searching
' TAR1 ' but what if it is the last word on that line. ' TAR1 ' wont work because last word on line is not a spcae ' '. i dont know. can someone help me out.

Atif


0

Response Number 3
Name: Jc
Date: June 18, 2004 at 22:20:04 Pacific
Reply:

grep -w "TAR1" <file>

Jc


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Search file & add string after that

Shell Script - directory help? www.computing.net/answers/unix/shell-script-directory-help/5184.html

Need unix driver for Toshiba CD-ROM XM-1202B www.computing.net/answers/unix/need-unix-driver-for-toshiba-cdrom-xm1202b/223.html

Simple shell script(csh) needed www.computing.net/answers/unix/simple-shell-scriptcsh-needed/8338.html