It does not happen very often: two posts in two days. But hey – if I have something (IMO) worth sharing, why wait?
Today I got question about parsing text file and while working on a solution I got idea how one can easily leverage named captures to create custom object on-the-fly.
This tip may be helpful to most of people, but is specifically targeted for people who share code on blogs and any similar media where width is issue at times.
So far I had two solutions, depending on the pipeline “type”:
- multi-command pipeline – breaking on the pipe symbol
- single-command pipeline – splatting
I avoid backtick (`) as hell, because single whitespace added by potential user after it and whole code becomes broken.