Skip to content
Advertisement

Tag: shell

condition match with find and if else in bash

I want to see the files which are before 15 days modified into a directory. if not found before 15 days, then look for 10 days before. My Attempt Answer FileList is a string which holds the names of all files (separated by spaces), for instance something like /var/log/foo /var/log/bar. You then test in your condition whether you have one

How to parse fix message to JSON format by Linux command [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I have fix message file that would needed to be converted to JSON format, like below. How can I use a shell script to convert

How to get consolidated count of delimiter occurrence

I have a requirement to fetch the count the occurrence of ‘|’ in each line of a file then match the count with given inputcount, needs to throw exception when the count is wrong. Say if the inputcount=3 and the file has following content then exception should get thrown on executing the line 2 and it should exit the file.

How can I select only the rows In file 1 that match column values in file 2?

I have multiple measurements per ‘Subject’ in file 1. I only want to use the highest quality, singular measurement per Subject. In my second file I have the exact list of which measurement is the best for each Subject. This information is contained in the column ‘seriesnumber’. The number in the ‘seriesnumber’ column in file 2 corresponds to the best

How to copy a file to all subdirectories?

How can I paste read-me.jpg file into all sub-directories? Here is a command to create a new file in all subdirectories. But I want to copy jpg file into all subdirectories instead. Directory List: already tried with this command but no output Answer You tried to redirect cp’s output into $dir but instead we should specify the destination $dir/read-me.jpg as

run multiple commands in docker after container start

how can I run /bin/run1.sh and /bin/run2.sh after the container startup! also, if you can tell me how can I send the logs of /bin/run1.sh and /bin/run2.sh to container logs!! Docker file entrypoint.sh run1.sh run2.sh Answer You can change ENTRYPOINT [“entrypoint.sh”] to ENTRYPOINT [“entrypoint.sh”, “run1.sh”, “run2.sh”] which will run your custom bash scripts you also need to create the log.txt

Advertisement