Not sure if this is posted to the right place.
I have a script that is trying to get the day and month of an entered file name. I found this code which will print it out:
#!/bin/ksh
month=`date +%m`
day=`date +%d`
ls -l $FILE | nawk -v month=${month} '
{ printf("%s\n", index($(NF-3), ":"
? month : $(NF-3));
}
'
ls -l $FILE | nawk -v day=${day} '
{ printf("%s\n", index($(NF-2), ":"
? day : $(NF-2));
}
'
Is there anyway to store the printed answer in a variable instead of writing it to the sreeen?
Thanks in advance,
Steph
I have a script that is trying to get the day and month of an entered file name. I found this code which will print it out:
#!/bin/ksh
month=`date +%m`
day=`date +%d`
ls -l $FILE | nawk -v month=${month} '
{ printf("%s\n", index($(NF-3), ":"
}
'
ls -l $FILE | nawk -v day=${day} '
{ printf("%s\n", index($(NF-2), ":"
}
'
Is there anyway to store the printed answer in a variable instead of writing it to the sreeen?
Thanks in advance,
Steph