I’m monitoring from an actively written to file: My current solution is: However when attempting to do this with AWK I don’t get the output – the $ws_trans and $sc_trans remains 0 Attempting to do this to reduce load. I understand that AWK doesn’t deal with bash variables, and it can g…
Tag: bash
reading file line by line in an infinite loop until break
I’m trying to implement an infinite loop bash script for reading in a file, doing something and check counter condition, when counter condition reaches 0 it breaks out of the infinite loop. I’ve tried several iteration and none has worked for me. Pseudo-code would be something line this.. Can anyo…
Bash script that prints statistics about text files [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 4 years ago. Improve this ques…
using for in loop with sql output
I have a roles.txt file that contains SELECT ROLE_NAME FROM SENTRY_ROLE WHERE ROLE_NAME produces: Im trying to echo all the roles from roles.txt that are not in the sql_output (user in this example). This is what i have so far: Answer That’s not how you iterate over the lines of a file. See http://mywik…
Converting from batch to shell
I have a set of batch commands that I’m trying to convert to shell so I can use them on my linux environment. The command should read In windows (using batch), running this command should produce a set of files that are numbered like this: 0001_inside.hdr 0002_inside.hdr etc. However, when I ran this co…
echo does not print a variable in bash
I’m facing a very strange issue. I have 2 files ber_log_before.txt and ber_log_after.txt. Their contents are ber_log_before.txt ber_log_after.txt There are $ it’s normal. Then I wrote a basic bash command to parse them Why 1st val 14 2em val 24 is not echoed??? If I replace by Then at least I have…
Bash Create Directories/Subdirectories Using Two Lists
I would like to create a number of directories, each with a number of subdirectories based on two lists using Bash. Currently, the below code achieves this result: Yields Question: Is there a cleaner (non-single-line) way to achieve the same result, perhaps storing the two lists as arrays or variables and usi…
Search for a mention of each filename contained in a directory, in every file in the directory
I’m trying to perform a search in my directory, to count the total number of times each individual file is referenced within the contents of all the files in the directory. Essentially, I’m trying to more efficiently recreate the copy and paste of each ‘filename’ into the ‘search…
How to limit a search of a directory with “find” command?
I am trying to make a Bash script that would create symlinks to directories that have a “target” subdirectory. I use “find” command to search for the “target” directories and put the filepaths to array. The array is looped through and symbolic links are made to directories.…
Return the ls -l output in docker container
So I have a docker container running which has a couple of folder/files inside. When I go inside the container I can see that they are: hostmachine$> docker exec -it testContainer bash testContainer@testContainer:~$ ls -l My question is: What script, how can I use it on my hostmachine that will: 1) Echo ba…