10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i am having file like this
#!/bin/bash
read -p 'Username: ' uservar
match='<color="red" />'
text='this is only a test
so please be patient
<color="red" />'
echo "$text" | sed "s/$match/&$uservar\g"
so desireble output what i want is if user type MARIA
this is only a test
so please... (13 Replies)
Discussion started by: tomislav91
13 Replies
2. Shell Programming and Scripting
I am trying to extract a time from the below string in perl but not able to get the time properly
I just want to extract the time from the above line I am using the below syntax
x=~ /(.*) (\d+)\:(\d+)\:(\d+),(.*)\.com/
$time = $2 . ':' . $3 . ':' . $4;
print $time
Can... (1 Reply)
Discussion started by: karan8810
1 Replies
3. Homework & Coursework Questions
Good Evening. I'm new to C. Can you please help me.
I'm creating an error checking function, user will input a string, this will check if the input is all alphabet or all letters only. If there is a digit or other special char, it will print Error then ask input from user again.
Here's my... (1 Reply)
Discussion started by: eracav
1 Replies
4. Shell Programming and Scripting
Hi
I have one thing I need advice on, and I don't know where to start so I have no sample code.
I want the user to provide input like: 1-3,6,7,9-11
When the input is like this, I want a string to be generated including all the numbers. In the example above, the string would look like:
1... (13 Replies)
Discussion started by: Tobbev
13 Replies
5. UNIX for Dummies Questions & Answers
I have code that accepts input from a user, and when the user hits enter it is supposed to delete that whole line from the file.
echo "Which record? "
read record
sed '/$record/d' file
However, it does not delete it. Any help? (1 Reply)
Discussion started by: itech4814
1 Replies
6. Shell Programming and Scripting
Hi,
echo "Enter file name of input file list along with absolute path : "
read inputFileList
if
then
for string in `cat inputFileList`
do
echo $string
done
else
echo " file does not exist"
fi
From the above code, if the user enters a invalid file... (1 Reply)
Discussion started by: i.srini89
1 Replies
7. UNIX for Dummies Questions & Answers
I have the following input:
xxxx-2.7.19_WR3
I have extract the following:
2.7.19
Can anyone suggest an awk or sed command to do the above...:confused:
another condition is
if the input is :
xxx-xxx_xxx-1.4-1_WR3.0bg.armv6jel_vfp
it shud still extract : 1.4-1
whenever "-"... (12 Replies)
Discussion started by: xerox
12 Replies
8. Shell Programming and Scripting
Hi,
I'm trying to extract the middle of an array that is of
variable length but always has a first and last common
element,
The following works OK...
#!/bin/bash
ARRAY='switch'
ARRAY='option1'
ARRAY='option2'
ARRAY='option3'
ARRAY='value'
SWITCH=${ARRAY:0:1}
VALUE=${ARRAY:(-1)}... (1 Reply)
Discussion started by: ASGR
1 Replies
9. Shell Programming and Scripting
I have a string stored in a variable. For instance,
$str = " Opcode called is : CM_OP_xxx "
where xxx changes dynamically and can be either LOGIN or SEARCH..... depends on runtime.
For example :
$str = " Opcode called is : CM_OP_SEARCH "
$str = " Opcode called is : CM_OP_LOGIN "
I... (3 Replies)
Discussion started by: vkca
3 Replies
10. Shell Programming and Scripting
Hi Everyone,
I stored the result of a certain awk script in the variable arr.The result is /inets /banking /tools.
arr= /inets /banking /tools
These are 3 direcctories. I should be able to move in to these directories using "cd" command.Can you tell me how to extract... (5 Replies)
Discussion started by: saicharantej
5 Replies