10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix.
I've tried to do this with a while loop, but instead of printing the prefix I print the first line of the file twice.
Files:... (3 Replies)
Discussion started by: pathunkathunk
3 Replies
2. Shell Programming and Scripting
Hi,
I am working on a script, which requests users to enter input.
Ex: read -p "Please enter your email id:" email
I don't want users skipping this entry, this has to be mandatory.I dont want to proceed without input.
I can do a check if variable $email is empty and proceed if not.But, i... (7 Replies)
Discussion started by: aravindadla
7 Replies
3. UNIX for Dummies Questions & Answers
I need to search a string for some specific text which is no big deal using grep. My problem is when the search fails to find the text. I need to add text like "na" when my search does not match.
I have tried this command but it does not work when I put the command in a loop in a bash script:
... (12 Replies)
Discussion started by: jojojmac5
12 Replies
4. Shell Programming and Scripting
Dear Friends,
I am looking for a shell script to merge input files into one file .. here is my idea:
1st paramter would be outfile file (all input files content)
read all input files and merge them to input param 1
ex: if I pass 6 file names to the script then 1st file name as output file... (4 Replies)
Discussion started by: hyd1234
4 Replies
5. Shell Programming and Scripting
Hi
I am new to writing script and want to use a Bash Piped while-read and read from user input.
if something happens on server.log then do while loop or if something happend on user input then do while loop.
Pseudocode something like:
tail -n 3 -f server.log | while read serverline || read... (8 Replies)
Discussion started by: MyMorris
8 Replies
6. Shell Programming and Scripting
Hello all,
I have file like this:
file 1:
aa
bb
cc
dd
ee
file2:
111
111
111
111
111
111 (2 Replies)
Discussion started by: attila
2 Replies
7. Shell Programming and Scripting
Hi,
This is most likely a dumb question but I could not find answer to it elsewhere.
I'm building a simple menu with case /esac and want to read user's input:
Please enter XYZ ; read XYZ
How do I take the value of XYZ and insert it as a variable $XYZ in file file.txt ?
I may need to... (9 Replies)
Discussion started by: svetoslav_sj
9 Replies
8. Shell Programming and Scripting
I am trying to match a pattern exactly in a shell script. I have tried two methods
awk '/\<mpath${CURR_MP}\>/{print $1 $2}' multipath
perl -ne '/\bmpath${CURR_MP}\b/ and print' /var/tmp/multipath
Both these methods require that I use the escape character. I am guessing that is why... (8 Replies)
Discussion started by: bash_in_my_head
8 Replies
9. UNIX for Dummies Questions & Answers
Hey everyone,
Basically, all I'm looking for is a way to regex for not a certain string. The regex I'm looking to avoid matching is:
D222
i.e. an equivalent of:
awk '!/D222/'
The problem is that I use this in the following command in a Bash script:
ls ${source_directory} | awk... (1 Reply)
Discussion started by: kdelok
1 Replies
10. Programming
how i can read a long integer from standar input and a string with as many characters as specified in the number?
i thing that i must use the read command ofcourse.... (6 Replies)
Discussion started by: aintour
6 Replies