10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
This is the first time I see something like this, and I don't why it happens.
Please give me some help. I am really appreciate it.
Basically I am trying to remove all empty lines of an input..
#!/bin/bash
set -e
set -x
str1=`echo -e "\nhaha" | grep -v ^$`
#str2=`echo -e "\n" |... (4 Replies)
Discussion started by: yoyomano
4 Replies
2. UNIX for Advanced & Expert Users
echo "hello123" | tr -dc '' | wc -c
using this command i can count the no of times a number from 0-9 occurs in the string "hello123"
but how do i save this result inside a variable?
if i do
x= echo "hello123" | tr -dc '' | wc -c
that does not work...plz suggest..thanks (3 Replies)
Discussion started by: arindamlive
3 Replies
3. Shell Programming and Scripting
What's the easiest way to search a file for a specific string and then look for other instances after that? I want to search for all Virtual Hosts and print out the Server Name and Document Root (if it has that info), while discarding the rest of the info.
Basically my file looks like this:
...... (6 Replies)
Discussion started by: Mbohmer
6 Replies
4. UNIX for Dummies Questions & Answers
Hello everybody, this is my first post here, I think IŽll be here for a long time :D
I wanted to know how I can assign each single character from a string to an array...
For example, "unix"
I have to set,
array=u
array=n
array=i
array=x
However, that string may change in each... (5 Replies)
Discussion started by: Gartlar
5 Replies
5. Shell Programming and Scripting
Hello everyone,
My problem looks quite simple , how to assign a string with spaces and lines "\n" to a variable.
I've tried all kind of quoting and is impossible, bash always try to execute the string and never executes a simple assignation.
This is part of the code
... (1 Reply)
Discussion started by: trutoman
1 Replies
6. Shell Programming and Scripting
When the following is typed:
/usr/platform/`uname -i`/sbin/prtdiag | awk '{print $7; exit}'
...the output I get back is either "X4150" or "X4170" when executed on a Sun Fire X4150 or X4170. ---But, may I ask how do I assign the variable $model to it?
Because of the embedded backquotes, I... (3 Replies)
Discussion started by: chatguy
3 Replies
7. Shell Programming and Scripting
I know many will probably say go read some tutorials...I would like to say that I am. However, I need to know this for work and it needs to be done soon.
In my script I have a while loop that reads a .tbl file of 4 columns and assigns them to variables a, b, c, d.
Once in the loop i do
... (10 Replies)
Discussion started by: questionasker
10 Replies
8. Shell Programming and Scripting
Hi
I am new to shell scripting and i am preparing a script.
for now i am work on a sub part of it..but i am unable to make it work.
---
the test code that i am working on
--------------------------
IFS=""
Sample_eve=`psg proc_s | grep tY`
n=0
for line in $Sample_eve... (41 Replies)
Discussion started by: Anteus
41 Replies
9. Shell Programming and Scripting
Hi Forum,
I am struggling with the for loop in shell script.
Let me explain what is needed in the script.
I have a file which will conatin some strings like
file1
place1
place2
place3
checkpoint
some other text
some more text
Now what my requirement is
the words ... (2 Replies)
Discussion started by: siri_14
2 Replies
10. Shell Programming and Scripting
like connect "summer" and "winter" to "summerwinter"?
Can anybody help me? thanks a lot. (2 Replies)
Discussion started by: fontana
2 Replies