10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
My aim is to get the md5 hash of a file and store it in a variable.
var1="md5sum file1"
$var1
The above outputs fine but also contains the filename, so somthing like this 243ASsf25 file1
i just need to get the first part and put it into a variable.
var1="md5sum file1"... (5 Replies)
Discussion started by: JustALol
5 Replies
2. Shell Programming and Scripting
hi,
i am writing a shell script in which i read a line in a variable.
FNAME="s1.txt s2.txt s3.txt s4.txt s5.txt"
i want to create a array and store single file names in a array..
so the array should contain
arr="s1.txt"
arr="s2.txt"
arr="s3.txt"
arr="s4.txt"
arr="s5.txt"
how to... (3 Replies)
Discussion started by: Little
3 Replies
3. Shell Programming and Scripting
Hi,
I want keep/save one command's output in an array and later want to iterate over the array one by one for some processing. instead of doing like below-
for str in `cat /etc/passwd | awk -F: '$3 >100 {print $1}' | uniq`
want to store-
my_array = `cat /etc/passwd | awk -F: '$3 >100 {print... (4 Replies)
Discussion started by: sanzee007
4 Replies
4. Shell Programming and Scripting
I am writing the code in perl.
I have an array in perl and each variable in the array contains the data in the below format
Now I need to check the below variable w.r.t system month I need to store the date and time(Tue Aug 7 03:54:12 2012) from the below data into file if contains only 'Aug'... (5 Replies)
Discussion started by: giridhar276
5 Replies
5. Shell Programming and Scripting
Hello,
Following my learning of shell scripting.. I got stuck yet again.
If I execute this command on terminal:
$ sed "s/off/on/g" file > fileAUX
I successfully change the text off to on from file to fileAUX.
But the same command is not working inside a shell script. I tested and... (2 Replies)
Discussion started by: quinestor
2 Replies
6. Shell Programming and Scripting
Respected All,
Kindly help me out.
I have got file listings in a directory like this:
-rw-r--r-- 1 root root 115149 2011-11-17 07:15 file1.stat.log
-rw-r--r-- 1 root root 115149 2011-11-18 08:15 file2.stat.log
-rw-r--r-- 1 root root 115149 2011-11-19 09:15 file3.stat.log
-rw-r--r-- 1... (2 Replies)
Discussion started by: teknokid1
2 Replies
7. Shell Programming and Scripting
Hi. I wanted to create a Perl script which can take the outputs of a Perl script as it's input and temporarily store them in a document. Need help.
Thanks.:) (8 Replies)
Discussion started by: xtatic
8 Replies
8. UNIX for Dummies Questions & Answers
I'm sure this is a simple thing but I can't figure it out. In a script that I'm writing, I'd like to be able to store each line of output from "ls -l" into a variable. Ultimately I'd like to end up with something like:
for a in `ls -l`
do something with $a
doneBut that's reading each... (2 Replies)
Discussion started by: ewoods
2 Replies
9. Shell Programming and Scripting
I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows:
$count = 0;
while ( $count < $#test )
{
`sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`;
`cat 0 >... (2 Replies)
Discussion started by: userix
2 Replies
10. Shell Programming and Scripting
hi
this is an example of code:
use strict;
use warnings;
open FILE, "/tmp/result_2";
my $regex="\\ Starting program ver. (.*)";
my $res="Program started, version <$1> - OK.\n";
while (<FILE>) {
if ($_ =~ /($regex)/) {
print "$res";
}
}
close FILE;
This finds $regex and print... (3 Replies)
Discussion started by: xist
3 Replies