more simple as it is , is impossible .
This one can be tested over the terminal without a script .
Quote:
echo 1234 | sed "s/1234/*/g"
|
The problem i have is that i can change the text only to 1 * , and i want sed to replace the number of character in the search with the same number of * .
The most easy answer from anyone to this would be :
CODE]
echo 1234 | sed "s/1234/****/g"
[/CODE]
But the example i am writing here is not what i will use in the code , because in my code that "1234" i a variable that does not have a fixed size of characters .
for a script for test it could be used this one with user input :
Code:
#!/bin/bash
echo -n "Write anything to be turned to * : "
read var
out=$(echo $var | sed "s/$var/*/g")
echo ""
echo "Your input $var was converted to $out"
Does anyone knows this one ?