Bash shell. I'm trying to filter a string taken from user input. I can replace one word at a time. This method supports regex, so is it possible to replace various words at a time?
STRING="Hello World! word1 word2";
FILTERED=${STRING/word1|word2/}; # Not working: replace 2 or more words ???
... (10 Replies)
Hi!
I need the following script:
- All numbers in a filename (0-9) have to be replace by a String ("Zero"-"Nine")
- The script has to go through all the files in the current directory and has to replace the numbers as described above...
I have no idea how to do this...
Thanks!
Michael (5 Replies)
I have been viewing man pages and using google with little luck so far. I am writing a shell script using wbemcli.
I can execute the command and get the results I need just fine.
ex. wbemcli -nl ein 'http://<username>:<password>@<host>/<targetpc>/root/wmi:MSAcpi_ThermalZoneTemperature'
... (3 Replies)
I googled this and couldn't find an answer, so I rolled my own. Here it is, hope it helps. Feel free to improve on it.
#!/bin/bash
PWORD=
ANYKEY=0
echo -n "Password: "
until
do
read -N 1 -s ANYKEY
echo -n "*"
PWORD="$PWORD$ANYKEY"
done
echo
echo $PWORD
exit (3 Replies)
I'm going freakin crazy here! I've tried multiple attempts and configurationa and cannot get this to work.
I have a file:
private/etc/apt/sources.list.d/cydia.list
I want to replace a string in this file:
"deb http:name.of.address ./"
with
"deb http:name.of.other.address ./"
The... (4 Replies)
Hi All
I am a new in scripting language and I would like help for you guys
I would like to create a file named constant.h and search into all files *.m in specific directory for a reg-exp @"LBL_]+" exp: @"LBL_75847" , and write those matchs to constant.h if there are not written (no... (15 Replies)
Hi. I'm a complete noob when it comes to scripting. I have approximately 2000 files scattered throughout different locations that I need to rename. The current files have a character, "." , that needs to be replaced with an underscore. I have no clue which route to go about correcting this.... (4 Replies)
Morning,
I'm trying step up my scripting game .. :rolleyes::confused::D
Is there a way to do the replacement with an or without using an external command ?
I did try but no joy.
var=${var//\(|\)/}
#!/bin/bash
var="lulus.UbiRwidgets.com (10.1.1.1)"
var=${var//\(/}... (5 Replies)
Hi all,
i have a .csv file with only two columns, like:
Login;Status
Luca;S
Marco;
Stefano;
Elettra;S
Laura;
...
I need to replace the blank space on Status column whit Enabled end, on the same column, S whit Disabled, like:
Login;Status
Luca;Disabled
Marco;Enabled
Stefano;Enabled... (10 Replies)