Hi All,
I have a property in a file as:
property=value=a
If I use FS="=" then I want only first = to be considered as field separator and remaining as value
echo -e "property=value=a" | awk -F= '{print $2}'
ie my $2 should be value=a
Can anyone please help me with this. I need it in awk
Thanks in Advance
Guru
echo "property=value=a" | awk -F= '{print $2"="$3}'
or
echo "property=value=a" | awk 'BEGIN{FS=OFS="="}{print $2, $3}'
Regards
Thanks for your reply franklin..
I am reading the properties from a file:
so there can be other files with
property=value
in this case I can't print using OFS="=" as there is no 3rd field
How to do in that case
In that case:
awk 'BEGIN{FS=OFS="="}{print $(NF-1), $(NF)}'
Regards