So I need to create a lot of text files. Each of the text file is named AAAAA.txt, BBBBB.txt, CCCCC.txt and etc etc. Within each text file, all the content is as follows: 1.Copy “to-be-replaced”.txt into the folder EXCLUSIVE. 2.Copy the gs file to replace the existing gs file. 3.The .projectdata s…
Tag: bash
Sed: select first part of price
Seems that my sed command is not working. I am trying to select the 2 in $2.99. However, no matter how I seem to type the regex, it will only give the .99 I want to select everything (every number) that is not the dollar sign up to the period. Any suggestions? echo “$2.99” | sed -e ‘s:^([^\$…
Linux Bash find files on user input with multiple -name clauses
I am trying to create small utility to collect log files from remote host by creating tar ball, for simplicity assume for now assume to just display list of files based on user input. This command works fine If i programmatically want to update -name clause based on the user input, say for example user input …
How to get logs of individual argument passed to shell script from a file
I have a shell script. In this script I am reading table names for a file and executing a command. The script is working fine. I am able execute the command for all the tables in the file. shell script In this script I want to collect status logs and stdout logs. I want to collect the logs for each
pip install pickle not working – no such file or directory
Ubuntu 16.04 LTS, trying to install cpickle with pip. I’ve searched a bit, haven’t found anything useful yet. PYTHONPATH isn’t set. Error message troubleshooting steps Answer Checking on the interweb, I found this A common pattern in Python 2.x is to have one version of a module implemented …
Expanding when one has command substitution
I have to echo an output of a command substitution concatenated with string. The string to be prepended is in fact the string of pathname. The need for use of absolute path together with filename arises due to filename containing special character,-, at the beginning of it. I’ve come up with a draft tha…
Append input URL from user to variable in file using shell script
I have one file test.txt it have already some data named export website_URL and export username= test.txt start.sh here creating new file from test.txt writing data in to data.txt file here if I put input to website_URL=”http://stackoverflow.com/questions/6543841/php-cli-getting-input-from-user-and-then…
PuTTY: Linux window – How to update the window title during a function?
I’m accessing a Linux machine from a Windows 10 PC via PuTTY. I’ve set the PuTTY (Bash) window title to ‘$PWD’ by setting $PS1 as below: This works well – whenever I change the directory in the shell, the title updates straight away: However, if I change directory in a function (as below) the title doesn’t up…
Bash script: too many arguments in [ test ]
I have the bash script below: When I run it: As you can see, when I don’t pass parameters ( $# -eq 0 ) it fails with “too many arguments”. So, I tested it directly in terminal: So, if it works perfectly in terminal why doesn’t it work passing parameters? Thanks, Answer Your entire expr…
script to check script is running and start it, if it’s stopped
I have a script with this name : Run.sh I run this script with this command : I don’t like stop this script but this script Suddenly stops and need run again. I need a script to check it , if my run.sh stopped , run it again. this is run.sh codes: And i want run this script at boot