9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi
i need to get the 3rd line in a string.
actually, not sure if it's a string, list, array, or something else. I'm using grep to retrieve all the numbers in a string-- in the console, it displays as multiple lines:
$ echo "Sink 0: reference = 0: 153% 1: 45%, real = 0: 62%" | grep -o *
0... (4 Replies)
Discussion started by: johnywhy
4 Replies
2. Shell Programming and Scripting
Hello,
I want to delete all lines with given string in file1 and the string val is dynamic.
Can this be done using sed command.
Sample:
vars="test twinning yellow"
for i in $vars
do
grep $i file1
if
then
echo "Do Nothing"
else
sed `/$i/d` file1
fi
done
Using the above... (5 Replies)
Discussion started by: PrasadAruna
5 Replies
3. Shell Programming and Scripting
I would like to use a string as a command line argument...is this possible using TCSH? For example say my script is called TEST and I would like to pass a string into my script stating why the test failed.
EXAMPLE:
TEST "Failed due to missing statement" (4 Replies)
Discussion started by: thibodc
4 Replies
4. Shell Programming and Scripting
I am passing a list of strings $list and want to remove all entries with --shift=number, --sort=number/number/..., --group=number/number/... Also are removed whether upper or lower case letters are used
For example the following will all be deleted from the list
--shift=12
--shift=2324... (7 Replies)
Discussion started by: kristinu
7 Replies
5. Shell Programming and Scripting
This has been bothering me for 3 days.
$> hostname
cepsun64amd
And I just want "cepsun",
I would normally do h=`hostname`; ${h%%64*}
But I am looking for a one-liner just for my own knowledge, because if there is a way to do this, I should know it by now.
Anyway, so is this... (2 Replies)
Discussion started by: Ryan.
2 Replies
6. Shell Programming and Scripting
Input:
MD5(secret.txt)= fe66cbf9d929934b09cc7e8be890522e
MD5(secret2.txt)= asd123qwlkjgre5ug8je7hlt488dkr0p
I want the results to look like these, respectively:
MD5(secret.txt)= fe66cbf9 d929934b 09cc7e8b e890522e
MD5(secret2.txt)= asd123qw lkjgre5u g8je7hlt 488dkr0p
Basically, keeping... (11 Replies)
Discussion started by: teiji
11 Replies
7. Shell Programming and Scripting
I want to add a "-r <remote_host>" option to my ksh script, causing the script to run a script of the same name on the specified remote host. The remote invocation should itself include all the command-line options of the original invocation, less the -r option.
For example, this invocation:
... (7 Replies)
Discussion started by: mattmiller
7 Replies
8. UNIX for Advanced & Expert Users
All,
Is there any way out to display the nth line before the string is matched ???
Eg : If i have a file which has the following contents and if i want to get the
3rd line before the string is matched
a
b
c
d
e
f
if i give the input as f and lines before the match as 3 then it should... (5 Replies)
Discussion started by: helper
5 Replies
9. Shell Programming and Scripting
my description from another thread...
here's my code:
#!/bin/bash
IFS=$'\n'
function OutputName() {
input=$1
echo $input
input=`echo "$input" | sed -e 's/.//'`
input=`echo "$input".avi`
output_name=$input
}
if ]; then
echo... (5 Replies)
Discussion started by: TinCanFury
5 Replies