Search Results

Search: Posts Made By: soleil4716
1,951
Posted By soleil4716
#!/bin/bash drink="cafe tea cocoa" echo...
#!/bin/bash

drink="cafe tea cocoa"
echo $drink | grep -q $1

if [[ $? == 0 ]]; then
echo "Match is Found"
fi
4,715
Posted By soleil4716
Not sure what you will gain by using fork if all...
Not sure what you will gain by using fork if all server names are in one file. If you have multiple files then your pings can run in parallel.

May be it is time to do some actual testing :)
4,715
Posted By soleil4716
Writing into the same file will be a problem for...
Writing into the same file will be a problem for sure. But you can write to different file based on the input parameters and once all the processes finish, you can 'cat' them and write the output to...
4,715
Posted By soleil4716
How about writing one ping script and passing the...
How about writing one ping script and passing the file name as a parameter.

Then you can have a wrapper script that runs the processes in the background:

ping_script file1 &
ping_script ...
2,657
Posted By soleil4716
You can try running your ssh command in the...
You can try running your ssh command in the background and then follow it by a loop. The loop keeps running as long as it sees the ssh command in a 'ps -al' listing.

However, the loop needs to...
1,311
Posted By soleil4716
$ cat infile COLA COLB ...
$ cat infile
COLA COLB COLC COLD COLE COLF COLG COLH
AAAA 86 111 122 133 144 155 266 377
BBBB 70 211 222 ...
2,644
Posted By soleil4716
If you use the '\1' thing you have to specify the...
If you use the '\1' thing you have to specify the location using \(\)
2,644
Posted By soleil4716
echo "hello linux, hello linux."|sed...
echo "hello linux, hello linux."|sed 's/linux\([,\.]\)/unix\1/g'
9,475
Posted By soleil4716
my $minus_one_day = time - 86400; my $yesterday...
my $minus_one_day = time - 86400;
my $yesterday = localtime $minus_one_day;

print("yesterday: $yesterday \n");
1,887
Posted By soleil4716
'find' command inconsistency
I am seeing a strange behavior of the 'find' command on AIX. As you can see,
the find command sometimes finds the file and sometimes does not based on how
many characters I specified between the...
21,828
Posted By soleil4716
'testfile' is just a name. You can give it any...
'testfile' is just a name. You can give it any name you want. It will be an empty file with a modification date set to midnight.

The second command will show all files that are newer than that.
21,828
Posted By soleil4716
I am not sure '-mtime 0' will give you what you...
I am not sure '-mtime 0' will give you what you want. I found some code on the Internet to get today's file and tested it on my machine:


touch -t `date +%m%d0000` testfile
find . -type f -newer...
3,976
Posted By soleil4716
naree, How is the line inside the input file...
naree,

How is the line inside the input file generated? May be we can design a better solution by going to the root of the problem. If the line is generated by some SQL query, you may be able to...
16,508
Posted By soleil4716
Why are you doing 'SELECT *'? Why not...
Why are you doing 'SELECT *'?

Why not 'SELECT field3'?
3,574
Posted By soleil4716
Here is a simpler solution: #!/bin/ksh...
Here is a simpler solution:



#!/bin/ksh

echo "Please input instance name:"
read my_instance
grep -i "^$my_instance:" /opt/oracle/admin/etc/oratab 2>&1 > /dev/null

rc=$?

if (( $rc ==...
9,949
Posted By soleil4716
You can try doing an 'echo $PWD' to see the value...
You can try doing an 'echo $PWD' to see the value of the working directory. Most likely the value will be different when run from cron. Specifying the absolute path is always a good idea.

Not sure...
9,949
Posted By soleil4716
Ideally you should pass the username and password...
Ideally you should pass the username and password inside the here doc for security reasons:


sqlplus -s <<!
<USERNAME>/<PASSWORD>
@<SQL FILE TO EXECUTE>
exit
!
1,693
Posted By soleil4716
Use a for loop: for i in {1..10} do ...
Use a for loop:


for i in {1..10}
do
echo "$i"
done
1,693
Posted By soleil4716
You cannot use ${fnom.1}. You need to use...
You cannot use ${fnom.1}. You need to use ${fnom}.1

Use curly braces only around the variable name.
1,693
Posted By soleil4716
You can use: ${filename}.${numberinput}
You can use:

${filename}.${numberinput}
5,654
Posted By soleil4716
Try using 'gawk' instead of 'awk' if you have it...
Try using 'gawk' instead of 'awk' if you have it available on your system and see if that fixes the problem or not. I think 'awk' has some limitation with record lengths.
5,654
Posted By soleil4716
host1> head -1 file1 > outfile host1> sed...
host1> head -1 file1 > outfile
host1> sed '1d;$d' file1|sed '$d'|awk '{print substr($0, 1, 8); print substr($0, 9, 7)}' >> outfile
host1> tail -2 file1 >> outfile
host1> cat outfile
header...
5,654
Posted By soleil4716
Another option is to use sed and awk. Assuming,...
Another option is to use sed and awk. Assuming, file1 content is like the
following:


host1> cat file1
header
summary1detail1
summary2detail2
summary3detail3
trailer1
trailer2


You can...
3,149
Posted By soleil4716
What about lines in source2 that are not in...
What about lines in source2 that are not in source1?
3,149
Posted By soleil4716
I think the best approach would be this: ...
I think the best approach would be this:


grep -vxf sourcefile2 sourcefile1 > file3
grep -vxf sourcefile1 sourcefile2 >> file3


We need to do it both ways since there can be unique entries...
Showing results 1 to 25 of 67

 
All times are GMT -4. The time now is 04:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy