Search Results

Search: Posts Made By: ajaypatil_am
3,517
Posted By ajaypatil_am
Perl code to check date and check files in particular dir
Hi Experts,

I am checking how to get day in Perl.
If it is “Monday” I need to process…below is the pseudo code.
Can you please prove the code for below condition.

if (today=="Monday" )
...
11,059
Posted By ajaypatil_am
Sorting file content by file extensions
Hi Experts,

I have one .txt file which has filenames with various extensions e.g. .gz,.dat,.CTL,.xml. I want to sort all the filenames as per their extensions and would like to delete all the...
8,189
Posted By ajaypatil_am
Thanks zaxxon but this is not working....printing...
Thanks zaxxon but this is not working....printing 0
8,189
Posted By ajaypatil_am
Calculating total space in GB for all files with typical pattern
Hi Experts,

In a particular dir, I have many files *AJAY*.
How can I get total size of all such files.
I tried du -hs *AJAY* but it gave me individual size of all files.
All I require is...
2,852
Posted By ajaypatil_am
Trying to add currrent date as the first the first column in the file
Hi Experts,

I am trying to add one variable value as the first value in a file speparated by "" (space) delimiter. Can you please let me know how I can do this using bash script.

Following is...
2,961
Posted By ajaypatil_am
I want the uncommon contents from 2 files e.g. ...
I want the uncommon contents from 2 files
e.g.
file1
a b c d e
file2
a d
expected output
b c e
I would prefer a shell script than perl.In both the files contents will be unique meaning a b...
2,961
Posted By ajaypatil_am
sorry if i was not clear ...the both the files...
sorry if i was not clear ...the both the files will contain only one 'ajay' only one 'suhas' but there can be thousand of such names...
all i want is the thrid file with names which are there in...
2,961
Posted By ajaypatil_am
there are thousands of lines.No number of line...
there are thousands of lines.No number of line can be different in both the files
2,961
Posted By ajaypatil_am
comparing 2 files and creating third file with uncommon content
I want to compare 2 files and create third file with uncommon content.
e.g.
file1
ajay suhas tom nisha vijay mahish
file2
ajay suhas tom nisha

expected output file content
vijay mahish
...
4,670
Posted By ajaypatil_am
getting error sh: syntax error at line 1: `a=$'...
getting error sh: syntax error at line 1: `a=$' unexpected
4,670
Posted By ajaypatil_am
Thanks itkamaraj this is working but when i...
Thanks itkamaraj this is working but when i connect to the another server using ssh then hostname it takes is actually previous server ...
e.g.


ssh userid@servername
h=`hostname`;df -k | nawk...
4,670
Posted By ajaypatil_am
Hi itkamaraj, I tried following 1.typing...
Hi itkamaraj,
I tried following
1.typing following command at command prompt

h=$(hostname);df -k | awk -v h="$h" '!/dcs/ && NR>1 {if(substr($5,0,length($5)-1)>87)print h" "$5" " $6}' >>...
5,106
Posted By ajaypatil_am
thanks this checks recursive also ? i am...
thanks this checks recursive also ?
i am getting many "Permission denied" msgs how to avoid those...
actually after "sr" there can be any number from 0-9 so i precisely want to list only those...
4,670
Posted By ajaypatil_am
thanks itkamaraj but i am getting awk:...
thanks itkamaraj but i am getting

awk: syntax error near line 1
awk: bailing out near line 1
4,670
Posted By ajaypatil_am
df command for listing 90% + dirs and hostname condition
df -k | grep -v dcs |grep -v Filesystem| awk -F" " '{if(substr($5,0,length($5)-1)>87)print $5" " $6}' >> sms.txt

1) Is it the correct way to list all the filesystems > 90%
2) Is there any way...
10,973
Posted By ajaypatil_am
if condition for file size
i want to put if condition for particular statement. The statement should only execute if particular file size is < 4 kb.

Please let me know the correct way.
5,106
Posted By ajaypatil_am
find all the dirs starting with particular name
Hi Experts,

I want to find all the dirs , subdirs on the sever which start with "sr".
Can anyone let me know command for the same.

find . -type d -name sr* I tried this but it is not...
3,707
Posted By ajaypatil_am
Following code is working fine in bash but it is...
Following code is working fine in bash but it is not working fine in sh
strange ! :confused:

#!/bin/bash

#Count number of subdirs
count=`find . -type d | while read d
do [ $(( $(ls -a1 $d |...
3,707
Posted By ajaypatil_am
Thanks itkamaraj for your help. It is working...
Thanks itkamaraj for your help. It is working fine from command prompt but when I write it in the script I am getting
rmchk.sh: syntax error at line 1: `(' unexpected
Script

count=`find . -type...
3,707
Posted By ajaypatil_am
Sorry for confusion it is working fine...only...
Sorry for confusion it is working fine...only thing it counts those dirs also which has empty files ..is there anyway to exclude those dir from the total count..
3,707
Posted By ajaypatil_am
i) This is storing ls -lR | grep -c "total 0" in...
i) This is storing ls -lR | grep -c "total 0" in $count ...and not the number of empty dirs...
ii)
ls -lR | nawk '/^\./{f=$1}/^total 0/{print f}'
displays those dirs also which has empty files...
3,707
Posted By ajaypatil_am
Thanks itkamaraj This is working fine at...
Thanks itkamaraj
This is working fine at command prompt but when i write it inside script I am getting
syntax error at line 1: `count=$' unexpected error
3,707
Posted By ajaypatil_am
This is not working . I am getting error find:...
This is not working . I am getting error
find: bad option ac
find: path-list predicate-list



---------- Post updated 01-12-12 at 12:24 AM ---------- Previous update was 01-11-12 at 04:21 AM...
3,707
Posted By ajaypatil_am
No it doesnt (:- I have modified script as...
No it doesnt (:-
I have modified script as below
#!/bin/sh
if [ $1 -eq '' ]; then
echo "Searching '$1' dir for empty subdirs \n"
fi
echo "Following empty dirs are going to be deleted \n"
ls...
3,707
Posted By ajaypatil_am
Thanks jayan_jay, This works fine but one...
Thanks jayan_jay,
This works fine but one problem.
I have dir structure ./a/b/c/d/e/f/g/h ...it displays all of them even if they are not empty...
Showing results 1 to 25 of 64

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