Looping all subdierctories in multiple pipes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Looping all subdierctories in multiple pipes
# 1  
Old 05-15-2014
Looping all subdierctories in multiple pipes

Hello friends,
I want to run this code on every document in every sub-directory.
Code:
tr -d '\n' < MulitpleInput.txt | awk '{gsub(/\. /,".\n");print}' | grep “\[" >> SingleOutput.txt

I tried several looping techniques but couldn't get it to run in this example. Any ideas?

Thank you
# 2  
Old 05-15-2014
I can't tell from your code what you are trying to do.
If you are looking to change, a lot of files, the find
command works well along with sed.

You may want to show what is in the input files
and what the output files should look like.
# 3  
Old 05-15-2014
Whatever you're up to, the tr is unnecessary and potentially problematic. Its output is not a valid text file and its length could pose a problem for some awk implementations.

You can achieve the same effect directly with awk and an empty ORS.

Regards,
Alister
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Looping through multiple arrays in C.

Not sure if this is possible, but I've tried this about a thousand ways now. I am making something with a lot of arrays. I thought I could put the array names into a separate array and then loop through them to call all of their elements. This is the best I've got so far: #include <stdio.h>... (4 Replies)
Discussion started by: Azrael
4 Replies

2. Shell Programming and Scripting

Looping for multiple directories

Hi experts, I am totally stuck with this. I run a looping "for" command for multiple directories, manually, I have done this : vfor dir in A B; do cp -p $dir/X.txt X-${dir}.txt done where A and B is directory name. However, I need to run for many directories. So I have tried this :... (7 Replies)
Discussion started by: guns
7 Replies

3. Shell Programming and Scripting

multiple looping with case and funtion showing error, Please help

Hello All, I have code as follows :- while true do {opening a case1 statement} 1) {opening another case2 statement} {closing case 2} 2) Showing error for "2)" as Syntax error at line 59 : `)' is not expected. *) {closing case 1} ... (5 Replies)
Discussion started by: Renjesh
5 Replies

4. Shell Programming and Scripting

awk modify multiple columns with pipes

Hello, I have a CSV-like dataset where some of the columns contain HTML snippets which I need to convert to XHTML. For any given snippet, I have a functioning config for the text processor 'tidy' such that tidy -config tidy.cfg example.html does the job I need done. I would like to process... (10 Replies)
Discussion started by: bstamper
10 Replies

5. Shell Programming and Scripting

Why cannot have multiple pipes from tee?

why I cannot do this? prog_name | tee logfile | awk /regexp/ | awk /regexp/ I now this is not elegant code, but am intrigued as to why multiple pipes from tee not allowed. (2 Replies)
Discussion started by: euval
2 Replies

6. Programming

Pipes in C

Hello all, I am trying to learn more about programming Unix pipes in C. I have created a pipe that does od -bc < myfile | head Now, I am trying to create od -bc < myfile | head | wc Here is my code, and I know I might be off, thats why I am here so I can get some clarification. #include... (1 Reply)
Discussion started by: petrca
1 Replies

7. UNIX for Dummies Questions & Answers

Help in Array looping and creating multiple lines

hi Gurus, I'm a newbie in scripting please check my script if this is correct. I think there's something wrong with it but I;m not sure. I'm trying to create multiple lines using awk from external xml files but i want to add additonal info in the data manually Since i don't knwo how to... (0 Replies)
Discussion started by: sexyTrojan
0 Replies

8. Shell Programming and Scripting

Multiple pipes toward a single awk command

Hello, I would like to pipe two variables into awk, but I don't know how to do. Each variable, "a" and "b", are in fact a list of data. They are not files. So to get awk to work with it I am using: echo $a | awk 'FNR==NR{print $1}FNR!=NR{print $4}' The above works, but when I am... (5 Replies)
Discussion started by: jolecanard
5 Replies

9. Shell Programming and Scripting

cd using pipes

Hi, Can the cd command be invoked using pipes??? My actual question is slightly different. I am trying to run an executable from different folders and the path of these folders are obtained dynamically from the front end. Is there a way in which i can actually run the executable... (2 Replies)
Discussion started by: Sinbad
2 Replies

10. Filesystems, Disks and Memory

PIPEs and Named PIPEs (FIFO) Buffer size

Hello! How I can increase or decrease predefined pipe buffer size? System FreeBSD 4.9 and RedHat Linux 9.0 Thanks! (1 Reply)
Discussion started by: Jus
1 Replies
Login or Register to Ask a Question