10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a variable $WORDS that contains a string
Then i want to use sed to break it up.
echo $WORDS | sed 's// /g'
I tried setting this as a variable by doing
WORDS2=`echo $WORDS | sed 's// /g'`
But when i do this it does not return me to the prompt properly
ie.
jmpprd-v1>
jmpprd-v1>... (4 Replies)
Discussion started by: nitrobass24
4 Replies
2. Shell Programming and Scripting
#!/bin/bash
varA="AAA1"
varB="BBB2"
varC="CCC3"
for proccx in $varA $varB $varC
do
echo "the current name is ????? , the value is $proccx"
echo " "
done
#end of script
I want the output to look something like this:
the current name is varA, the value is AAA1
the current name is... (5 Replies)
Discussion started by: ajp7701
5 Replies
3. UNIX for Dummies Questions & Answers
I've testing the following code:
echo test.txt | cut -d . -f1and get the output "text"
So why can't i assign the command to a variable?
VAR='"echo test.txt | cut -d . -f1"'
echo $VAR (5 Replies)
Discussion started by: jl487
5 Replies
4. Shell Programming and Scripting
Hi,
i want to create an user-friendly script where you are asked for two numbers. i would like that these two number to be separated with "--" for example, but i can't figure out how to do this.
for example
read -p "Insert lowest and highest value: " min ; echo -n "-- "; read max
so... (3 Replies)
Discussion started by: ezitoc
3 Replies
5. Shell Programming and Scripting
Greetings,
I've visited this forums for a long time and normally got an right answer but this time my problem doesn't seem to go away. What I'm trying to do is the following:
VAR="\n\nline1\nline2\nline3\nline4\nline5\nline6\nline7\n\n"
(The count of newlines is varying!)
If I echo this i... (3 Replies)
Discussion started by: ph1l
3 Replies
6. Shell Programming and Scripting
Hi,
I am facing a strange problem. I have a script that used the following to search and replace text:
sed 's/'"${find_var_parm}"'/'"${find_var_filter}"'/g' $ParmFile > $TempFile
The values of $find_var_parm and $find_var_filter are set based on search criteria. The above seems to be working... (2 Replies)
Discussion started by: arsh
2 Replies
7. Shell Programming and Scripting
Hi, I'm a bit of sed n00b here.
My issue is as follows:
I'm trying to pass a variable to sed so that all instances of this variable (in a text file) will be replaced with nothing. However, the value of this variable will always be a folder location e.g. "C:\Program Files\Folder1"
I... (5 Replies)
Discussion started by: Mr_Plow
5 Replies
8. Shell Programming and Scripting
I understand how to use a variable in a sed command, but for the life of me I can't get the output into a variable.
I'm making a general function to replace part of a filename with a different string, so:
>>myscript this that
would change:
this_file001.txt to that_file001.txt and... (11 Replies)
Discussion started by: donflamenco
11 Replies
9. Shell Programming and Scripting
I am modifying an existing script and it has the following line:
export SomeEnvVar=`echo ${SomeLocalVar}`
Why wouldn't it just read:
export SomeEnvVar=${SomeLocalVar}
Is there some reason to use echo instead of a direct assignment? :confused: (2 Replies)
Discussion started by: shellburger
2 Replies
10. Shell Programming and Scripting
hi
I have say five variable.
I would ask the user which one they want me to print and then print accordingly.
TEST_1='10.2.3.4'
TEST_2='11.2.3.5'
TEST_3='12.2.3.5'
TEST_4='13.2.3.5'
TEST_5='14.2.3.5'
print_var()
{
echo "Accessing var num $1"
echo TEST$1
#??? But How do... (6 Replies)
Discussion started by: sabina
6 Replies