I have loads of geographical json files with date_geohash.json name format and I have to convert them to date_latitude-longotude.json format. For example I need to convert 2017-03-28_u13hhyn.json to 2017-03-28_N52.76-E1.62.json. I’m trying to write a bash script to rename these json files using ‘…
Tag: bash
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 …
How to display all commands of the bash shell in a file? Linux [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …
How do run executable c++ through terminal in debug mode?
I have a c++ executable file named test .. To execute it in my terminal I run….. Although I want to run it in debug mode wherein it shows the exact command being used immediately after being executed If you are wondering what exactly I mean by debug mode.. Just like how we use -x for shell scripts This …
How can I use merge command to merge 5 rows in this text file with 1 row in another text file?
Summary I have a 1.txt with following order like this: And another 2.txt with the order like (the line number=”2/3″ is constant, just the exon line is changed) How can I use the merge command or another command to merge 5 rows in 2.txt with 1 row in 1.txt to have the final result seem like: Many t…
Issue with setting environment variables permanently in linux bash [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 3 years ago. Improve this question I wan…
Doing an awk command for a conditional statement
I’m doing a bash script using the Awk command to format a file with some user info, and at the beginning of the script, I want it to say “if the value in column 1 is not in the format abc123, skip that line. It doesn’t seem to be working though. I had this previously: but of course that woul…
Is it possible to get current CPU utilisation from a specific core via /sys in Linux?
I would like to write a shellscript that reads the current CPU utilisation on a per-core basis. Is it possible to read this from the /sys directory in Linux (CentOS 8)? I have found /sys/bus/cpu/drivers/processor/cpu0 which does give me a fair bit of information (like current frequency), but I’ve yet to…
for loop in bash simply prints n times the command instead of reiterating
I have a input.txt file with over 6000 lines. If a line a has over 10 words then I want it to be split but not at the 10th word but where the first comma character appears. And, if the new line also has more than 10 words, then it should also be split, and keep reiterating this process 7
Outputting a decimal value as two little-endian hex bytes to a file
I have a need for a bash command that does the following: Write a new file in which the two first bytes contain the raw hex bytes (not ASCII) of a value (start address in this case). I.e., 49152 should be written to the file as 00 c0. I tried several combinations of printf, xxd, fold, tac/cat etc. This presen…