Here is the script was written which is based on while loop in shell scripting in Linux. I used a variable and wanted to increase the value of it till the value is less than 10. What problems could have occurred in the script? To find out I ran the script and the error is coming. Answer In line 6,
Tag: scripting
Using find to rename files recursively with random chars
I have an IP camera that takes snapshots and nests those snapshots into multiple directories. The sub directories look something like this. There is a ton of sub directories because of the way it stores files since it places those snapshots within a Minute directory of the Date/Hour directories. At any rate, there are other types of files mixed in,
What’s the best alias for not having to remember the branch I’m in to pull and push?
Extremely lazy here, don’t like to type too much and specially don’t like to remember on which branch I’m in to pull from and push to. Far too often I make the mistake of doing git pull from a non-master branch, or worse do a push and the target branch is incorrect and I’m left with un-pushed or uncommitted changes.
python filter lines matching keyworks
I have working python script producing following output. Script output Now i want want any line starting with stream in output so i am using following logic but its not working. Answer Your data is a massive string instead of a list of strings as you expected. Also it’s easier to use str.startswith instead of regex (less resource hungry). Simply
How to access specific path in linux using shellscript
Let us consider an example, scriptPath=/home/sharath/Downloads/Atollic_TrueSTUDIO_for_STM32_9.2.0_installer In the above line of code, If user is “sharath” then he can access a file/folder same way if the user is different how can access that folder/file dynamically. below is my shellscript(.sh file): In last line of the script, ${scriptPath} is diffrent for diffrent user, how can handle in shell script. Update 1:
Bash Scripting checking for home directories
I’m trying to create a script to check if user accounts have valid home directories. This is what i got at the moment: This works. I get the expected output which is the username of the account with an invalid home directory. eg. output However, I am unable to make it so that ONLY if there is no issues with
Extra percent sign appears in echo bash
I’ve got the following script below which is supposed to demo CPU utilization: For some reason, when the percentage is echoed out, two percent signs appear instead of the last digit of the number and a percent sign. For example, the output is sometimes 2.7%% instead of 2.72%. Everything works fine when I take the percent sign away, but even
print the count of files for each sub folder iterativly
I have the following folder structure: Similarly, Now, each folder from 00 to 23 has many files inside, which I would like to count. If I run this simple command: ls /A/B/C/D/E/00 | wc -l I can get the count of files in each of these sub directories. I want to automate this or get it iteratively. Also, the final
How to efficiently loop through the lines of a file in Bash?
I have a file example.txt with about 3000 lines with a string in each line. A small file example would be: I want to check all repeated lines in this file and output them. The desired output would be: I made a script checkRepetions.sh: However this script is very slow, it takes more than 10 minutes to run. In python
Awk script to sum multiple column if value in column1 is duplicate
Need your help to resolve the below query. I want to sum up the values for column3,column5,column6, column7,column9,column10 if value in column1 is duplicate. Also need to make duplicate rows as single row in output file and also need to put the value of column1 in column 8 in output file input file output file Tried below code, but it