I’m trying to make a simple batch file to compile some code and I can’t for the life of me figure out or find any information on how to do this. On Linux, I’m doing this: This basically finds all the files in ./bin-int/ with the extension .o, and use them as the input variable for the comman…
Tag: shell
Ubuntu shell script – Scanning the drive for archives: ERROR: No more files
I have installed the package p7zip-full for ubuntu and I am running the following shell script named 7z and placed within the same directory as the dataset zipped files The dataset folder looks as in the image and I get the error below although this certain file exists within my directory. How can I resolve t…
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 c…
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…
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…
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 num…
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 inste…
get multiple words after a specific word of HTML using linux/unix scripting
i have a file ‘movie.html’ : I want to get multiple word with pipe delimited like this: I tried this code: but the output isn’t as my expectation please help me, i am still a beginner Answer Parsing html with regex is not advised for several reasons (see https://stackoverflow.com/a/1732454/1…
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 [“entrypoi…
Script to merge all image files from a folder inside a pdf
I frequently have to merge a lot of images inside a pdf. Naturally, I’d like to automate this a bit. Here are the things I need: lossless merge into a pdf merge of most common image formats natural sorting of numbers (1.jpg, 2.jpg, and 10.jpg would be merged in this order, not as 1.jpg 10.jpg 2.jpg) can…