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 argument
Tag: loops
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
Concatenating hardcoded directory and user-created text file adds root-level paths when it shouldn’t
I have written a script to allow a restricted user access to deleting files on a production webserver. However, to prevent fat-fingering issues leading to accidental filesystem deletion/problems, I have hard coded the base directory in a variable… But the final result is not properly creating the desired path from hard-coded directory + user paths if they have a *
How to develop dialog gauge in tcl / tk that gets loop value and updates in scale widget by moving it
I’m trying to make a progress bar dialog like GNU/Linux Xdialog –gauge Apparently you should get a value, which is updated for ‘one second’, from time to time. This increment is done through a for loop already pre-configured to give the progressive count. From my tests I did, and how far my knowledge of tcl/tk could go is like this:
Single quoted full path files in a text file can’t do for loop processing mv: cannot stat … No such file or directory
I have a test file which contains a space-separated files that I want to move/delete. Example line: I want to move the files away to another directory in a for loop: But it gives me an error. Why? 2nd problem after this how could I move actually this file to the new place with included the original directory somehow in
Using lines from a file while looping over an unrelated numeric range in bash
I got a task to display all bash fonts/colors/background colors in table where the text is different for each variation and is being taken from file that contains 448 words/random number(I’m working with numbers). Here is my code for displaying all variations Output: enter image description here Code for generating random numbers: So the question is how can I pass
Submit executable + input files with qsub to create multiple jobs
I have an executable that takes one input file and have been running it like so, submitting as a job to pbs using qsub: I have a script (runpp_multi.sh) to make it run on multiple files in a directory: These both work fine, but obviously there’s a problem if I submit the script that runs on multiple files with qsub:
Delete certain columns and add horizontally in AW. So many columns that I cannot type each one
I have been struggling more than a day and I cannot make my script work. Please help. My txt file extends to 500 columns. I need to delete columns 5,9,13,21,…, always delete n=4 column. Then, after removing the columns I mentioned above, I need to add all the columns remaining, BUT NOT taking into account ONLY the column 1. For
Is there any faster way to grep the pattern or to increase the speed of while loop?
this loop is taking time because lacks of entry in main_file. Answer Your current approach is very inefficient – the whole loop could be done in a single grep, with the -f option. -F treats lines in file as strings, not patterns -x looks for exact matching line (if that is what you want) -f file reads the lines from
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 function. Thanks a lot, Eric Answer In most cases, $var and