In the above snap shot i am going to grep for tag '{1:F' and i wanted to get the 3 characters after tag '{2:I' the value '103'.
The tags '{1:F' & '{2:I' are fixed so based on this i wanted to get the 3 chars coming after '{2:I'. So my motivation is to get 3 chars after tag '{2:I'.
Thanks for your reply. Actually the tags i mentioned are fixed in position but nobody knows when they might change the position for future requirements. So i want to fetch based on the {2:I tag only.
eachfile was the file which has the file name path. '30' was the position of the required value tag {2:I. This gave me empty value in the document type field. I am not sure the value in command i entered correct or not.
Thanks for your reply.
---------- Post updated at 06:30 PM ---------- Previous update was at 06:28 PM ----------
Hi,
I tried this command as like below it gave me the exact value '103' i was looking for.
document_type=`perl -nle '/\{2:I(\d{3})/ and print $1' $eachfile | sort | uniq | sed -e "s/^[ ]*//g" | sed -e "s/[ ]*$//g`
Thanks.
---------- Post updated at 07:14 PM ---------- Previous update was at 06:30 PM ----------
Hi,
I tried this command as like below it gave me the exact value '103' i was looking for.
Why the loooong pipe? If you want to remove leading spaces, do so in awk . If you want to remove trailing spaces, do so in awk . If you want unique values, do so in awk .