Skip to content

Tag: loops

run a command with a file pattern

I have this file patterns.txt And I want to run a specific command for every pattern like this: I tried to used for loop like this: but i didn’t work Answer The 2 typical approaches are: and Note that I would expect both of those to fail, since scp expects at least 2 arguments. How you want that 2nd arg…

Loop to filter out lines from apache log files

I have several apache access files that I would like to clean up a bit before I analyze them. I am trying to use grep in the following way: I have several terms that I want to grep, so I am piping every grep action as follow: Until here my rudimentary script works as expected! But I have many apache

Linux: Loop using foldername when finding file

I’m currently trying to use the following linux script to loop through folders and perform calculations using a function: The problem: How can I use the foldername to find the correct file? For example, the foldername is scan1 and I want to use the file called gaf_scan1_recording_mic.nii for the functio…