Hello
I want to get end date of the any month in unix . is there any function to do this.
we can get month from date command 'date +%b'
example:
If Feb month then last date is 28
if sep then last date 30. like this
thanks
please help
Hello
I want to get end date of the any month in unix . is there any function to do this.
we can get month from date command 'date +%b'
example:
If Feb month then last date is 28
if sep then last date 30. like this
thanks
please help
Try this command
You can include this in a shell script to get the month and year to pass to the below command.
cal 10 05 | grep -v ^$ | tail -1 | sed 's/^.* \([0-9]*\)$/\1/'
try this,
cal <month> <year> | sed '/^$/d' | tail -1 | awk '{printf $NF}'
not working
please check once again.
thanks
Which solution is not working? Give the last two digits for year
echo $(cal 10 2005) | awk '{print $NF}'
cal 10 05 | xargs -n1 | tail -1
Note: `cal 10 05` != `cal 10 2005`
You cannot omit the century. `cal 10 05` is October in the year 5 AD.
typo .
Dear friends
in unix one file containing this following data.
test data:
70 noaa-17 hrpt 2005/09/16 259 04:32:00 11:40 4203
42 noaa-17 hrpt 2005/09/16 259 06:12:00 10:50 3905
Now I want to move first line in to another file and simulataniously delete that line in original file.
i think sed command is useful but i dont know the optins how it should give.
please give reply
regards
rajan
Your problem is in no way related to the original thread. You should start a new thread.
I doubt you can carry out your problem in one single sed solution. Unless you go with the advanced sed commands.
sed -n -e '1p' test.data > test.1st.line
sed -e '1d' test.data > test.data.tmp
mv test.data.tmp test.data
vino
Dear friends
how check in unix weather the file was blank ie (empty) .in shell programming.
because I have a file with two rows , iam reading each row using sed command and copying into another file.simultaniously i am deleting that line in original file.after two lines are written to other file that original file will empty.
I want to write condition in myscript until the original file become blank.
how to write this.
regards
rajan