Need to cut a string from a file recursively.

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Need to cut a string from a file recursively.
# 1  
Old 08-13-2009
Need to cut a string from a file recursively.

I have a file exep_file.txt with contents similar to,

[8/13/09 2:00:08 AM] [Thread1] xyx request 1329207.
[8/13/09 2:00:09 AM] [116271:RT1329207] sdf sedf sg gds request 1329207.
[8/13/09 2:00:11 AM] [116271:RT1329207] as as fa df sdf request 1329207.
[8/13/09 2:00:15 AM] [Thread0] xyx request 1329209.
[8/13/09 2:00:15 AM] [116271:RT1329209] sdf sedf sg gds request 1329209.
[8/13/09 2:00:16 AM] [116271:RT1329209] as as fa df sdf request 1329209.

I need an output like


only the request id's. How to cut only the request part,
Kindly help.
# 2  
Old 08-13-2009
awk '{ print $NR }' filename >  requests.txt

# 3  
Old 08-13-2009
awk '{ print $NR }' opp_exep_file.txt > requests.txt

It gives an output like,

cat requests.txt
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Search strings from a file in files in a directory recursively; then print the string with a status

Hi All, I hope somebody would be able to help me. I would need to search a string coming from a file, example file.txt: dog cat goat horse fish For every string, I would need to know if there are any files inside a directory(recursively) that contains the string regardless of case.... (9 Replies)
Discussion started by: kokoro
9 Replies

2. Shell Programming and Scripting

How can I use find command to search string/pattern in a file recursively?

Hi, How can I use find command to search string/pattern in a file recursively? What I tried: find . -type f -exec cat {} | grep "make" \; Output: grep: find: ;: No such file or directory missing argument to `-exec' And this: find . -type f -exec cat {} \; -exec grep "make" {} \;... (12 Replies)
Discussion started by: cola
12 Replies

3. Shell Programming and Scripting

How to find and replace a string with spaces and / recursively?

Hi all, I wanted to find and replace an email id from entire directory structure on a Linux server. I found that find . -type f -print0 | xargs -0 sed -i 's/' would do it perfectly. But my search criteria has extended and now I want to search for a string1 like... (2 Replies)
Discussion started by: pat_pramod
2 Replies

4. Shell Programming and Scripting

Cut the string

Hi in a directory i've files having the following name for_category_info_19990101984301 for_catgry_meta_19991111214601 ------- I just want the name till year and month i.e; for_category_info_199901 for_catgry_meta_199911 How can i achieve the above string Thanks (2 Replies)
Discussion started by: smile689
2 Replies

5. Shell Programming and Scripting

Cut, replace and Paste a String from one file to another

I need to cut all the Strings in one file and Paste it in the another file in the Specific line by replacing the specific String. For Example Step 1: From the newfile.txt, i need to copy all the strings newfile.txt How are you, I am fine, How is your work newfle2.txt Hello david,... (2 Replies)
Discussion started by: Padmanabhan
2 Replies

6. UNIX for Advanced & Expert Users

Recursively search the string from a column in no. of files

i have a file named keyword.csv(contains around 8k records) which contains a no. of columns. The 5th column contains all the keywords. I want to recursively search these keywords in all .pl files(around 1k) and display the filename....Afterthat i will use the filename and some of the column from... (3 Replies)
Discussion started by: millan
3 Replies

7. Shell Programming and Scripting

Serach a string for multiple occurrences in a file and cut related texts

Hi, I want a help in this forum for my below issue. 1. I have a file where I'm searching for a text . 2. When I get the line where the above string is present I want to cut some texts from the line where the particular string was found. These above two steps will repeat in the... (2 Replies)
Discussion started by: bhaski2012
2 Replies

8. Shell Programming and Scripting

find and replace a search string recursively in files

Hi , I have a directory structure as dir and subdirectories and files under it and so I need to find the files which contain the search string under every dir and subdir and replace . my search string is like searchstring=/a/b string to be replaced=/a/c/b please help. ... (7 Replies)
Discussion started by: mohanpadamata
7 Replies

9. Shell Programming and Scripting

read string, check string length and cut

Hello All, Plz help me with: I have a csv file with data separated by ',' and optionally enclosed by "". I want to check each of these values to see if they exceed the specified string length, and if they do I want to cut just that value to the max length allowed and keep the csv format as it... (9 Replies)
Discussion started by: ozzy80
9 Replies

10. Shell Programming and Scripting

Replace all occurances of a string in all file-/foldernames, recursively

I need a script that will replace all occurances of a string in all filenames and foldernames, recursively. Right now I have this script: for f in `find -name *eye*`; do echo processing $f g=`expr "xxx$f" : 'xxx\(.*\)' | tr 'eye' 'm'` mv "$f" "$g" done The problem is that tr... (2 Replies)
Discussion started by: TheMJ
2 Replies
Login or Register to Ask a Question