Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Any easier way of parsing this file?



On Oct 19, 12:53am, DervishD wrote:
}
}     The file contents are contained in a parameter (long story...),
} and they MUST be contained in a parameter.
} 
}     Is there any better way of parsing this file using Zsh and
} assuming that I may be interested in gathering the information for
} other labels in the future?

Use IFS.  That's what it's for.

	print -r $data | while IFS='=' read label content
	do
	    case $label in
	    SOMELABEL) : ... $content ... ;;
	    ANOTHERLABEL) : ... $content ... ;;
	    esac
	done



Messages sorted by: Reverse Date, Date, Thread, Author