Search Results

Search: Posts Made By: nag_sathi
1,002
Posted By Scrutinizer
Hi, In awk all variables are initiated with...
Hi,

In awk all variables are initiated with a default value, which is "", and is equal to 0 in a numeric context.

On the first line the value for max is equal to this default value, and so...
2,427
Posted By RudiC
May I jump in as Don seems offline for a while...
May I jump in as Don seems offline for a while now?'


sed operates on files line by line, it reads a line, performs the entire script on it, and reads the next. * is not "all lines" but a sort...
2,427
Posted By Don Cragun
Hi nag_sathi, It looks like RudiC answered the...
Hi nag_sathi,
It looks like RudiC answered the question for you while I was sleeping last night. Do you still have questions about how that sed search command works?

Note that the ability to use...
1,108
Posted By Scrutinizer
Further notes: The backslash serves no...
Further notes:

The backslash serves no purpose here, you can leave it out.
There should be double quotes around the variable expansions "$file" "${file%.*}"
It is best to put -- (end of...
1,108
Posted By RavinderSingh13
Hello nag_sathi, This is called "parameter...
Hello nag_sathi,

This is called "parameter expansion" see following from documentation.



Here is the link for understanding parameter expansion too.
Shell Parameter Expansion (Bash...
1,108
Posted By RudiC
Yes, that's a "Parameter Expansion / Remove ...
Yes, that's a "Parameter Expansion / Remove matching suffix pattern".


man bash:
1,622
Posted By Don Cragun
You never answered the question of whether a file...
You never answered the question of whether a file named filexfile.txt should be moved to newfilexfile.txt or to newfilexnewfile.txt. And, I'm disappointed that you didn't try to rewrite your code...
1,622
Posted By Scrutinizer
Try something like: for i in...
Try something like:

for i in ~/Shell_Practice/rename/*.txt
do
if [ -e "$i" ]; then
mv -- "$i" "${i/file/newfile}"
fi
done

or
shopt -s nullglob
for i in...
1,622
Posted By RudiC
The necessary modifications to your own loop were...
The necessary modifications to your own loop were presented to you, to make it run, and to improve it. However, no sed nor awk are needed to solve your problem. Just use shell's "parameter...
1,730
Posted By RavinderSingh13
Hello Nag_sathi, Following command may help...
Hello Nag_sathi,

Following command may help you in same. It will delete the files older than 90 days with name


find . -type f -mtime +90 -name "tomcatfiles*.log" | xargs rm -rf


Also...
1,730
Posted By Don Cragun
There is no need to start up xargs for this. The...
There is no need to start up xargs for this. The following does the same thing without invoking xargs:
find . -type f -mtime +90 -name 'tomcatfiles*.log' -exec rm -f {} \;
1,730
Posted By bakunin
Please specify what exactly you mean by "3 month...
Please specify what exactly you mean by "3 month old":

exactly 3 months/90 days?
3 months/90 days and older?
3 months / 90 days and younger?

The command you wrote:

find . -mtime +90
...
1,730
Posted By dinesh1178
Better to use -exec operator. First use...
Better to use -exec operator.

First use this for verification:
find . -type f -mtime +90 -name 'tomcatfiles*.log' -exec ls {} \;

And then this for deletion:
find . -type f -mtime +90 -name...
1,371
Posted By RudiC
In linux, you should have a tool like unix2dos...
In linux, you should have a tool like unix2dos available. Try to apply this and report back.
1,664
Posted By Peasant
You will find it under /var/spool/cron
You will find it under /var/spool/cron
1,775
Posted By Skrynesaver
Taking the command apart we get... ...
Taking the command apart we get...

WORKFLOW_START_TIME=$(..) #assign the output of the contained command to WORKFLOW_START_TIME
perl -e # execute the following string under the perlinterpreter...
1,775
Posted By Skrynesaver
Horrible, but it works... ...
Horrible, but it works...

WORKFLOW_START_TIME=$(perl -e '@t= localtime(time() + (5 *(60 * 60 )));printf "%02d/%02d/%04d %02d:%02d:%02d\n", $t[4] + 1, $t[3],$t[5]+1900, @t[2,1,0]')
1,678
Posted By pamu
Please check my previous post. I have...
Please check my previous post.

I have corrected in the script.
1,678
Posted By pamu
I believe line is a variable you have used. ...
I believe line is a variable you have used.
better way you just assign it to variable. You are creating a file with > sign.

try

line=$(echo $line | tr '[:upper:]' '[:lower:]')or with awk...
1,678
Posted By jim mcnamara
You do realize that when you change the content...
You do realize that when you change the content (upper to lower is changing content) you break the decompression algorithm: meaning you can no longer reliably decompress the file correctly - you get...
1,326
Posted By Jotne
You should use only parentheses or back tics, not...
You should use only parentheses or back tics, not both
st_date=$(`date "+%Y%m%d"`)

Best
st_date=$(date "+%Y%m%d")

ok
st_date=`date "+%Y%m%d"`

Edit: I now see that its ok in the full...
1,326
Posted By vidyadhar85
Is that your full script? Error says line 8 and...
Is that your full script? Error says line 8 and your code is in line 4.
1,673
Posted By pamu
I would advise to you to start use of functions...
I would advise to you to start use of functions in the script.

while [[ ! -f "$file" ]]; do
if [[ $lc -lt 15 ]]
then
sleep 15 # this should 60 as it is in seconds
let lc=lc+1
print...
2,254
Posted By pravin27
Hi, grep search pattern "ORA-" in status.log...
Hi,
grep search pattern "ORA-" in status.log file and redirect the stdout to /dev/null
2>&1 mean redirect stderr to stdout,in your case stdout is already redirected to (output of grep command)...
48,912
Posted By Scott
$# represents the number of arguments: $...
$# represents the number of arguments:


$ set -- a
$ echo $#
1

$ set -- a b c
$ echo $#
3
Showing results 1 to 25 of 56

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