Shell scripting

1.how to compare two date field values and ?
2.how to find and replace the filename in a given directory.
i have directory \usr\svpoller\ALF\prd\-649595282--649595281-1311131326638#integ_asns_ALF_1YBN_2
I want to find all the same files and want to remove(cut)the prefix before #.
I mean i want a output like integ_asns_ALF_1YBN_2 in the given directory \usr\svpoller\ALF\prd\

That directory name is not valid on a unix or Linux system. It is presented in Microsoft MSDOS format.

i m using on a putty server

  1. Compare two date fields on the basis of what?
  2. To find a file, use the find command. Check man find for help. Typically, the following is used:
find ./ -name <file_name>

to find a file recursively in current directory. To replace the filename, use mv command.
3. When you say, "I want to find all the same files", what do you mean?

And, for the example you mentioned "-649595282--649595281-1311131326638#integ_asns_ALF_1YBN_2", you can do something like this:

echo '-649595282--649595281-1311131326638#integ_asns_ALF_1YBN_2' | cut -d# -f2

This will give you "integ_asns_ALF_1YBN_2" as output.

Thanks for a prompt reply
I have two date fields having value like
Wed Nov 9 09:34:20 EST 2011 & Wed Nov 10 19:14:20 EST 2011
So how tocompare these.
If value matches I need to return some statement.
Help me

Put the two date fields in two separate variables and wrap them in an if-else condition. Not sure if this is what you're looking for.

#! /bin/bash
date1='Wed Nov 9 09:34:20 EST 2011'
date2='Wed Nov 10 19:14:20 EST 2011'
if [ '$date1' == '$date2' ]
then
    echo "Dates match"
else
    echo "Dates dont match"
fi

it works i guess but not exactly..
how can i store a value of date field in a particular properties file of that in a particular filed.
for eg. directory is Alfdorf-ALF|Wed Nov 9 09:34:20 EST 2011|0
I need to redirect the value of the date value dynamically using script and used it in further program.
This directory is a structure format made in properties file

I'm not able to understand your question.

:frowning:
how can i store a value of date field in a particular properties file of that in a particular filed.
for eg. directory is Alfdorf-ALF|Wed Nov 9 09:34:20 EST 2011|0
I need to redirect the output value using script and used it in further program.

This is hard to follow. You have 4 threads going, but there only seems to be one requirement - extracts fields from a parameter file (aka. properties file) and do something unspecified with those fields.
I note that in another post, the directory name in the properties file is in unix format. In scripts you must use the unix format.
http://www.unix.com/shell-programming-scripting/172111-unix-command.html#post302577184

The running theme of the various threads is how to get the parameter values from this "properties file".
Using the version of the file your posted earlier:
http://www.unix.com/unix-dummies-questions-answers/172111-unix-command.html#post302577169

Here is an example on one method:

cat poller_update_checking.properties | while read line
   do
        # Extract fields to variables
        property1=`echo "${line}"|awk -F'|' '{print $1}'`
        property2=`echo "${line}"|awk -F'|' '{print $2}'`
        property3=`echo "${line}"|awk -F'|' '{print $3}'`
        property4=`echo "${line}"|awk -F'|' '{print $4}'`
        #
        # Display output
        echo "property1 = ${property1}"
        echo "property2 = ${property2}"
        echo "property3 = ${property3}"
        echo "property4 = ${property4}"
   done
property1 = Alfdorf-ALF
property2 = /usr/svpollers/ALF/prd
property3 = Wed Nov 9 09:34:20 EST 2011
property4 = 0