Sponsored Content
Top Forums Shell Programming and Scripting How to select the path that contains a certain string from a certain file? Post 302296946 by sunpraveen on Thursday 12th of March 2009 07:42:00 AM
Old 03-12-2009
Try this. I am sure this can be shortened but I am not that kind of a SME in UNIX! Smilie

Code:
find . -name *.project >> /tmp/filelist.txt
cat /tmp/filelist.txt | while read line
do
  grep "<string_to_search_for>" $line
done

HTH,Smilie

Regards,

Praveen
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How To Replace A String In File With A String Containing Windows File Path

Hi, I have a file with the following contents # Lines that start with a # are comments. # # Calling TOAD like this will perform a comparison from command line : # # "C:\Program Files\Quest Software\Toad for Oracle 9.6\toad.exe" -c... (2 Replies)
Discussion started by: rajan_san
2 Replies

2. Shell Programming and Scripting

Select particular string using AWK

Hi all, i searched this forum for the awk help i needed but i couldnt get any thread matching to my problem, My problem is i have a file file1 { <Server CloneID="13k6equ4c" Name="EnterpriseServicesClone2"> <Server CloneID="13k6eqvi1" Name="EnterpriseServicesClone1"> ... (7 Replies)
Discussion started by: usha rao
7 Replies

3. Shell Programming and Scripting

regex to select last part of a path

Hi all, I am learning the use of regular expression and I would like to know which regex can be used to select only the last part of a directory path name. Something like: /dir1/dir2/dir2 and I want to select the last /dir2 where dir2 can be any kind of string. Thanks a lot for your help.... (7 Replies)
Discussion started by: elric
7 Replies

4. Shell Programming and Scripting

How to select only the most frequent instances of a variable string in a file?

I've got a web access file that I want to grep (or awk or perl or whatever will work!) out the most frequent instances of unique IP entries. Meaning the file looks something like this: I'd like to run a sort or grep (or whatever) that will only select out the lines from IP's that had the... (7 Replies)
Discussion started by: kevinmccallum
7 Replies

5. Shell Programming and Scripting

Remove path string from file (string contains "/")

This is the way sed -i 's/home/$USER/.config/hello_there//g' /home/$USER/.gnomerc But, as far as I saw you cannot add any "/" in the string you want to remove.... So, what should I do in order to remove this path (which contains "/") ?:confused: (7 Replies)
Discussion started by: hakermania
7 Replies

6. Shell Programming and Scripting

Find and replace string from file which contains variable and path - SH

e.g. /home/$USER/.config replace it with "" (empty) Is this possible? I think you should play a bit with sharps ## and sed:b: (2 Replies)
Discussion started by: hakermania
2 Replies

7. Shell Programming and Scripting

How to select a single string

I am learning sed/awk. So, bear with me. I have successfully created a list (based on sed) which looks like: <cl:item href="clsysrev/XTT004/XTT05064.xml" productSubtitle="animals" unitStatus="today"IR"> <cl:item href="clsysrev/XTT007/XTT08581.xml" productSubtitle="humans"... (3 Replies)
Discussion started by: alonso_canada
3 Replies

8. Shell Programming and Scripting

How to select the shortest path in grep search?

Hi, How can I display only one shortest path (A/B/configure)? $ grep configure file.txt A/B/configure A/B/C/configure A/B/C/D/configure Thank you. (9 Replies)
Discussion started by: hce
9 Replies

9. UNIX for Dummies Questions & Answers

select and replace only those string which is followed by \tab

Hi I have a number of sequences and a string occurs a number of times in that sequence. How can I select and replace only those strings which are followed by \tab. for eg : my sequence looks like : string0 positive cd parent=string0 id =121 string0 string0 negative ef parent=... (2 Replies)
Discussion started by: sonia102
2 Replies

10. Shell Programming and Scripting

How to select First two directory in from path name?

Can somebody help me on below question I have path and i want to select first two directory name in variable how we can do this. /Myname/xyz/yourname/abc/somebodyname i want to select /Myname/xyz in variable. Quick help will be appriciated. Thanks in advance Regards, Kumar (10 Replies)
Discussion started by: yadavricky
10 Replies
UNBUFFER(1)						      General Commands Manual						       UNBUFFER(1)

NAME
unbuffer - unbuffer output SYNOPSIS
unbuffer program [ args ] INTRODUCTION
unbuffer disables the output buffering that occurs when program output is redirected from non-interactive programs. For example, suppose you are watching the output from a fifo by running it through od and then more. od -c /tmp/fifo | more You will not see anything until a full page of output has been produced. You can disable this automatic buffering as follows: unbuffer od -c /tmp/fifo | more Normally, unbuffer does not read from stdin. This simplifies use of unbuffer in some situations. To use unbuffer in a pipeline, use the -p flag. Example: process1 | unbuffer -p process2 | process3 CAVEATS
unbuffer -p may appear to work incorrectly if a process feeding input to unbuffer exits. Consider: process1 | unbuffer -p process2 | process3 If process1 exits, process2 may not yet have finished. It is impossible for unbuffer to know long to wait for process2 and process2 may not ever finish, for example, if it is a filter. For expediency, unbuffer simply exits when it encounters an EOF from either its input or process2. In order to have a version of unbuffer that worked in all situations, an oracle would be necessary. If you want an application-specific solution, workarounds or hand-coded Expect may be more suitable. For example, the following example shows how to allow grep to finish pro- cessing when the cat before it finishes first. Using cat to feed grep would never require unbuffer in real life. It is merely a place- holder for some imaginary process that may or may not finish. Similarly, the final cat at the end of the pipeline is also a placeholder for another process. $ cat /tmp/abcdef.log | grep abc | cat abcdef xxxabc defxxx $ cat /tmp/abcdef.log | unbuffer grep abc | cat $ (cat /tmp/abcdef.log ; sleep 1) | unbuffer grep abc | cat abcdef xxxabc defxxx $ BUGS
The man page is longer than the program. SEE ALSO
"Exploring Expect: A Tcl-Based Toolkit for Automating Interactive Programs" by Don Libes, O'Reilly and Associates, January 1995. AUTHOR
Don Libes, National Institute of Standards and Technology 1 June 1994 UNBUFFER(1)
All times are GMT -4. The time now is 10:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy