Search Results

Search: Posts Made By: lijjumathew
Forum: Linux 11-15-2017
3,690
Posted By rbatte1
Bash variable substitution option
Even this could do the trick:-#!/bin/bash

while read full_filename
do
directory="${full_filename%/*}/"
filenames="*.${full_filename##*.}"
echo "${directory}${filenames}"
done <...
Forum: Linux 11-15-2017
3,690
Posted By RudiC
Try find /abc | awk '{sub (/[^\/]*\./, "*.");...
Try
find /abc | awk '{sub (/[^\/]*\./, "*."); T[$0]} END {for (t in T) print t}'
/abc/b/*.gz
/abc/b/*.txt
/abc/a/*.txt
Forum: Linux 11-14-2017
3,690
Posted By Yoda
find /abc -type f -printf "%h %f\n" | awk ' ...
find /abc -type f -printf "%h %f\n" | awk '
{
EX = $2
sub ( /[^.]*[.]/, X, EX )
A[$1 FS EX]
}
END {
for...
Forum: Linux 11-14-2017
3,690
Posted By jim mcnamara
Try something like this to start with. If you...
Try something like this to start with. If you find problems, show us what you did to fix them. First. Before saying 'this does not work':

find /abc -type d |
while read dir
do
ls -1...
3,026
Posted By ahamed101
Try this first to check for the right files ...
Try this first to check for the right files

find /tmp -user abcuser



And if you see the files are all correct and are the ones you want to delete, try this

find /tmp -user abcuser -exec...
2,872
Posted By bartus11
You can try:#!/bin/sh /script2.sh & ...
You can try:#!/bin/sh
/script2.sh &
WAIT_PID=$!
# do other stuff
wait $WAIT_PID
2,872
Posted By Scrutinizer
This is typically done like this: content of...
This is typically done like this:
content of script1:

/path/to/script2.sh & # execute script2 in the background
other_commands
more_commands
wait # wait for all background...
2,937
Posted By jim mcnamara
when=$(( $when + $fifty_days )) # change to ...
when=$(( $when + $fifty_days ))
# change to
when=$(( $when - $fifty_days ))

That is a minus sign.

Also changed the original post to reflect the change.
2,937
Posted By jim mcnamara
try this: note it uses ksh - if you use bash...
try this: note it uses ksh - if you use bash uncomment the red code; comment the blue code and change the shebang to /bin/bash

#!/bin/ksh
#
# assumptions - the LAST friday means:
# Find...
2,937
Posted By DGPickett
I wrote this ultimate time tool for all those...
I wrote this ultimate time tool for all those shell scripts wanting to do time stuff - parsing, clock, offsets and formatted output. Complex questions might mean you call it more than once or in a...
11,740
Posted By neutronscott
What shell do you use? Do you want a script...
What shell do you use? Do you want a script that'd list these certain files, or a function you'd use from the command line?
11,740
Posted By Don Cragun
Not surprising. With a numeric string...
Not surprising. With a numeric string 201206000000, the value being compared is 201206000000. With the string C201206000000, awk sees a variable name and since the variable hasn't been set, the...
11,740
Posted By Don Cragun
You don't need the int() for this comparison, and...
You don't need the int() for this comparison, and it will hurt you if you're not using an awk that uses 64-bit ints. Just use:

ls abc.* | awk -F'.' '$2>'201206000000' {print $0}'
11,740
Posted By Don Cragun
You say that the file naming convention is ...
You say that the file naming convention is

but the example looks a lot more like the convention is

I can't tell which it is from the data you supplied.
It is good that the convention uses YYYY...
11,740
Posted By Vryali
Think this should do you: $ awk -F'.'...
Think this should do you:

$ awk -F'.' 'int($2)>'201206000000' {print $0}' test.sh
abc.201206015423.txt
abc.201207013456.txt
Showing results 1 to 15 of 15

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