![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to print the word | ss_psm | UNIX for Dummies Questions & Answers | 0 | 03-17-2008 11:22 AM |
| Print the characters in a word | chella | Shell Programming and Scripting | 5 | 10-17-2007 06:06 AM |
| Using first word and print their contents using awk | cdfd123 | Shell Programming and Scripting | 6 | 10-10-2007 12:12 AM |
| Can a shell script pull the first word (or nth word) off each line of a text file? | tricky | Shell Programming and Scripting | 5 | 08-17-2006 03:29 AM |
| Print out just a word from the file | Kinki | Shell Programming and Scripting | 8 | 02-20-2005 08:40 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
print text between to word using shell
hello all
i need help to print text between -L and \myproject using bash shell command on following text. i am using sed to do but not get success. i want to print only C:\Users\myname\workspace\. how can i do? g++ -L"C:\Users\myname\workspace\myproject\lib\ffgeneralutil\lib" -L"C:\Users\myname\workspace\myproject\lib\ffsockwrapper\lib" -L"C:\Users\myname\workspace\myproject\MessageHandler\MsgLib\MtContainer\lib" -L"C:\Users\myname\workspace\myproject\lib\ffrs232\lib" -L"C:\Users\myname\workspace\myproject\lib\ffthread\lib" -L"C:\Users\myname\workspace\myproject\lib\md5wrapper\lib" -L"C:\Users\myname\workspace\myproject\lib\fflogger\lib" -L"C:\Users\myname\workspace\myproject\MessageHandler\MsgLib\LzoMessageCompression\lib" -L"C:\Users\myname\workspace\myproject\MessageHandler\MsgLib\MsgIntegrityUtil\lib" -L"C:\Users\myname\workspace\myproject\MessageHandler\MsgLib\MoContainer\lib" -o"myproject" $(OBJS) $(USER_OBJS) $(LIBS) @echo 'Finished building target: $@' @echo ' ' # Other Targets clean: -$(RM) $(OBJS)$(C++_DEPS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) myproject -@echo ' ' |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Code:
sed 's/-L"\(.*\)mypro.*/\1/' Regards |
|
#3
|
|||
|
|||
|
sed
no it is not helping. i need only "C:\Users\myname\workspace", part but is printing the whole paragraph. i only want to print above line. dosent matter how many times come in the file. hope i explained the point.
BR shailesh |
|
#4
|
|||
|
|||
|
Try this variation:
Code:
sed -n 's/.*-L"\([^ ]*\)\\mypro.*/\1/p' |
|
#5
|
|||
|
|||
|
sed
now it is not printing anything
br shailesh |
|
#6
|
|||
|
|||
|
I copied and pasted your sample text above into a file called t and ran it, and this is the output I get:
Code:
$ sed -n 's/.*-L"\([^ ]*\)\\mypro.*/\1/p' t C:\Users\myname\workspace $ |
|
#7
|
|||
|
|||
|
sed
my OS is open SUSE 10.3 and sed version is "GNU sed version 4.1.5". surprised why it is not working. i did the same on my machine and nothing comes out.
BR shailesh |
|||
| Google The UNIX and Linux Forums |