Extract data correction???

Hi

I have file "test.txt"

i need to extract the data as below from this file.

/home/cvs/gkc ->awk -v RS= '{print $(NF-2),$(NF-1),$NF}' test.txt
Buildfile: build.xml Buildfile: build.xml
Created dir: /dist/advance/2.0.4/20060926-0413
awk: The field -1 must be in the range 0 to 199.

The input line number is 3. The file is test.txt.
The source line number is 1.

I am getting all of the above errors i need only the following /dist/advance/2.0.4/20060926-0413 from that file without any spaces.
so that i will be using this data in another command.

can some one correct the above...

can you tell us what the input file contains ?
what are you trying to do?

my test.txt files contains the following data

create-tar:
[echo] Module : source-fileLayouts
[tar] Building tar: /dist/advance/2.0.4/20060926-0413/source-fileLayouts.tar
[tar] Building tar: /dist/advance/2.0.4/20060926-0413/source-broker.tar
[tar] Building tar: /dist/advance/2.0.4/20060926-0413/source-userExits.tar
[exec] ./cobbuff/co*ed* not found
[exec] ./cobbuff/db*ed* not found
[gzip] Building: /dist/advance/2.0.4/20060926-0413/source-userExits.tar.gz
[delete] Deleting: /dist/advance/2.0.4/20060926-0413/source-userExits.tar
[gzip] Building: /dist/advance/2.0.4/20060926-0413/source-fileLayouts.tar.gz
[delete] Deleting: /dist/advance/2.0.4/20060926-0413/source-fileLayouts.tar
[gzip] Building: /dist/advance/2.0.4/20060926-0413/source-broker.tar.gz
[exec] ./coblist/co*ed* not found
[exec] ./coblist/db*ed* not found
[exec] ./cobsize/co*ed* not found
[exec] ./cobsize/db*ed* not found
[delete] Deleting: /dist/advance/2.0.4/20060926-0413/source-broker.tar
[tar] Building tar: /dist/advance/2.0.4/20060926-0413/source-reports.tar
[gzip] Building: /dist/advance/2.0.4/20060926-0413/source-reports.tar.gz
[tar] Building tar: /dist/advance/2.0.4/20060926-0413/source-advance.tar
[delete] Deleting: /dist/advance/2.0.4/20060926-0413/source-reports.tar
[gzip] Building: /dist/advance/2.0.4/20060926-0413/source-advance.tar.gz
[delete] Deleting: /dist/advance/2.0.4/20060926-0413/source-advance.tar

create-tar:
[echo] Module : source-ccms

create-tar:
[echo] Module : source-crms

create-tar:

create-tar:
[echo] Module : source-codeReview
[echo] Module : source-claimCheck
[tar] Building tar: /dist/advance/2.0.4/20060926-0413/source-ccms.tar
[gzip] Building: /dist/advance/2.0.4/20060926-0413/source-ccms.tar.gz
[tar] Building tar: /dist/advance/2.0.4/20060926-0413/source-crms.tar
[tar] Building tar: /dist/advance/2.0.4/20060926-0413/source-codeReview.tar
[tar] Building tar: /dist/advance/2.0.4/20060926-0413/source-claimCheck.tar
[gzip] Building: /dist/advance/2.0.4/20060926-0413/source-crms.tar.gz
[gzip] Building: /dist/advance/2.0.4/20060926-0413/source-claimCheck.tar.gz
[gzip] Building: /dist/advance/2.0.4/20060926-0413/source-codeReview.tar.gz
[delete] Deleting: /dist/advance/2.0.4/20060926-0413/source-ccms.tar
[delete] Deleting: /dist/advance/2.0.4/20060926-0413/source-crms.tar
[delete] Deleting: /dist/advance/2.0.4/20060926-0413/source-claimCheck.tar
[delete] Deleting: /dist/advance/2.0.4/20060926-0413/source-codeReview.tar

BUILD SUCCESSFUL
Total time: 8 minutes 11 seconds
************************************************

i need only /dist/advance/2.0.4/20060926-0413 with out any spaces from the above file

I think you are looking for something like this:

grep /dist/advance/2.0.4/20060926-0413 test.txt | tr -d ' '

Output:

[tar]Buildingtar:/dist/advance/2.0.4/20060926-0413/source-fileLayouts.tar
[tar]Buildingtar:/dist/advance/2.0.4/20060926-0413/source-broker.tar
[tar]Buildingtar:/dist/advance/2.0.4/20060926-0413/source-userExits.tar
[gzip]Building:/dist/advance/2.0.4/20060926-0413/source-userExits.tar.gz
[delete]Deleting:/dist/advance/2.0.4/20060926-0413/source-userExits.tar
[gzip]Building:/dist/advance/2.0.4/20060926-0413/source-fileLayouts.tar.gz
[delete]Deleting:/dist/advance/2.0.4/20060926-0413/source-fileLayouts.tar
[gzip]Building:/dist/advance/2.0.4/20060926-0413/source-broker.tar.gz
[delete]Deleting:/dist/advance/2.0.4/20060926-0413/source-broker.tar
[tar]Buildingtar:/dist/advance/2.0.4/20060926-0413/source-reports.tar
[gzip]Building:/dist/advance/2.0.4/20060926-0413/source-reports.tar.gz
[tar]Buildingtar:/dist/advance/2.0.4/20060926-0413/source-advance.tar
[delete]Deleting:/dist/advance/2.0.4/20060926-0413/source-reports.tar
[gzip]Building:/dist/advance/2.0.4/20060926-0413/source-advance.tar.gz
[delete]Deleting:/dist/advance/2.0.4/20060926-0413/source-advance.tar
[tar]Buildingtar:/dist/advance/2.0.4/20060926-0413/source-ccms.tar
[gzip]Building:/dist/advance/2.0.4/20060926-0413/source-ccms.tar.gz
[tar]Buildingtar:/dist/advance/2.0.4/20060926-0413/source-crms.tar
[tar]Buildingtar:/dist/advance/2.0.4/20060926-0413/source-codeReview.tar
[tar]Buildingtar:/dist/advance/2.0.4/20060926-0413/source-claimCheck.tar
[gzip]Building:/dist/advance/2.0.4/20060926-0413/source-crms.tar.gz
[gzip]Building:/dist/advance/2.0.4/20060926-0413/source-claimCheck.tar.gz
[gzip]Building:/dist/advance/2.0.4/20060926-0413/source-codeReview.tar.gz
[delete]Deleting:/dist/advance/2.0.4/20060926-0413/source-ccms.tar
[delete]Deleting:/dist/advance/2.0.4/20060926-0413/source-crms.tar
[delete]Deleting:/dist/advance/2.0.4/20060926-0413/source-claimCheck.tar
[delete]Deleting:/dist/advance/2.0.4/20060926-0413/source-codeReview.tar

Hi

when i run that comamnd i get
grep /dist/advance/2.0.4/20060926-0413 test.txt | tr -d ' '
all the releated path.. in the file.

Conditons:
1) I need to dipslay only one line from the above file.
like when i run my script i need to get as below
/dist/advance/2.0.4/20060926-0413 with out any spaces.

2) "/2.0.4/20060926-0413 " will be changing ..for different files.

i will be using the output in another script as a variable.

Try...

eval $(awk 'match($0,/\/dist\/advance\/[^\/]+\/[^\/]+/){print "var=" substr($0,RSTART,RLENGTH);exit}' test.txt)
echo $var

That works..

Can you please explain me the above