Search Results

Search: Posts Made By: IND123
1,385
Posted By IND123
Okay. .. Any purpose behind it?. .. Or it is...
Okay. ..

Any purpose behind it?. .. Or it is like a dummy value assigned to some orbitery variable?.

Thank you.
1,385
Posted By IND123
Accessing local variable
Hi,

Would like to know the purpose and accessing of local variable as in below code snippet:

a=123
( a=321; )

echo "a = $a" #This will print 123

How to access local a variable...
60,246
Posted By IND123
The logical AND and OR conditions will remain...
The logical AND and OR conditions will remain same. Use "elif" in place of "Else if" and after the final else with the associated statement end the if block with "fi" .

Eg:

if [ $int1 = $int2 ]...
2,457
Posted By IND123
echo $cfg | grep ".log$" >/dev/null 2>&1 ...
echo $cfg | grep ".log$" >/dev/null 2>&1

flag=`echo $?`

if [ $flag -eq 0 ]; then
echo "$cfg ends with .log"
#perform your operations
else
#other operations of setting to...
1,932
Posted By IND123
I think this will work out for you, if the...
I think this will work out for you, if the strings are of similar type( its just a workaround, as you must expect a much better solution from forum folks!):

str=`echo "PUT 810 712 0001 ILC AK4...
1,932
Posted By IND123
quick reply: If you have a strings of...
quick reply:

If you have a strings of similar types, then you can use something like:

str=`echo "PUT 810 712 0001 ILC AK4 00 0 00 00" | sed 's/[ ]/,/5'`

echo $strIt will replace first 5...
8,226
Posted By IND123
How to exclude the empty directories
Hi.,

I have a script, in which I am processing a files present in the directory types.

ls -lrt | grep ^d | grep Dir_type | awk -f '{print $9}' |\

while read dir_name; do

#operations
...
5,750
Posted By IND123
Hi., I tried solution suggested by...
Hi.,

I tried solution suggested by "Klashxx". But it is resulting in following error:

Can't locate Time/Piece.pm in @INC
.....
BEGIN failed---Compilation aborted at line 3

I do have perl...
5,750
Posted By IND123
Difference of 2 dates in shell script
Hi.,

After retrieving values from DB I have two datestamps in format:

12/01/2010:05:40:00 AM and 12/01/2010:06:00:00 PM.

general time format: MM/DD/YYYY:HH:MM:SS AM or PM

Any quick...
9,730
Posted By IND123
Last modified time of the folder is changing when I view the file inside the directory
Hi.,

Last modified time of the folder is changing when I view the file inside the directory. Here is the test on sample directory. I believe that ls -l commands gives the time detail w.r.t last...
1,657
Posted By IND123
The solution suggested by "michaelrozar17" works....
The solution suggested by "michaelrozar17" works. .. But with a small change:

odt=`date +%d/%m/%Y -d "25OCT2008"`

echo $odt # You will get 25/10/2008
1,964
Posted By IND123
quick solution: var1=apple,boy,chris ...
quick solution:

var1=apple,boy,chris

var1=`echo $var1 | sed "s/,/','/g"`

var1=`echo "'"$var1"'"`

echo $var1 # Now it holds : 'apple','boy','chris'
4
1,291
Posted By IND123
Try with: find -atime +2 -name "*"
Try with:

find -atime +2 -name "*"
7,585
Posted By IND123
Try with below command: The general format is: ...
Try with below command:
The general format is:

touch -t YYYYMMDDHHMM.SS file_name/dir_nametouch -t 201002171050.00 abcd
1,008
Posted By IND123
linux_ver=`RHEL$(cat /etc/redhat-release | awk...
linux_ver=`RHEL$(cat /etc/redhat-release | awk '{print $7}') | awk -F "." '{print $1}'`

echo "linux_ver="$linux_ver

Just added another awk part to your code!.
Try it.
3,231
Posted By IND123
ls -lrt | awk '/Oct 4/ {print $NF}' |\ while...
ls -lrt | awk '/Oct 4/ {print $NF}' |\

while read filename; do
echo "File getting deleted is --> ${filename}"
rm -f "${filename}"
done;

You can put the above code in the...
4,102
Posted By IND123
Actually I tried with perl script which you have...
Actually I tried with perl script which you have given, but its not working out the way as it has to be, its showing - found once I execute the script and press enter key;

Can I get a solution...
4,102
Posted By IND123
How to check for file name of specific format using find?
I have to find the specific formatted file is present in the received list in the directory, for which I have written:


file_list=`ls -lrt /tmp/vinay/act/files |grep "$cdate"| awk '{print $9}'`...
7,500
Posted By IND123
How to process list of files as array in the script
Hi.,

In my script I have written :


file_list=`ls -lrt /tmp/vinay/act/files |grep "$cdate"| awk '{print $9}'`


To store list of files in the directory. Now I want to access it as list....
2,852
Posted By IND123
Extracting file name and finding extension of the file
Hi.,

How to extract the extension of a file which are present in the directory?. In my script I tried something like:

echo abc_ss_222_54.txt | awk -F"[_.]" '{print $5}'


But I din't got...
8,821
Posted By IND123
Hi., Thanks for your reply. The script is...
Hi.,

Thanks for your reply. The script is working properly.
Here can you tell me what set command is doing, as I am new to Shell scripting. And also how you are extracting last 2 fields using...
8,821
Posted By IND123
To extract date and time separately from the file name
Hi.,

My current script extracts only if the date and time are in 3rd and 4th pos.



#!/bin/bash
echo "Enter the file name to extract the timestamp"
read fname
IFILE=$fname
F=$IFILE...
Showing results 1 to 22 of 22

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