[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Input line splitting and OFS
From: |
address@hidden |
Subject: |
RE: Input line splitting and OFS |
Date: |
Mon, 18 Nov 2019 09:36:44 +0000 |
Thank you to everyone who has responded to my question.
As I explained, I was mainly looking for an explanation as to why, and you've
all made valid points in that regard, in particular about FS possibly be a
regex, and you've also given me some useful tips such as the difference between
resplitting and rebuilding.
As for my code itself, this was given purely as an example, and doesn't look at
all like my actual app which is an interpreter for a small language. For this
I've moved to reading $0 into an array before parsing, which has solved all of
my splitting issues which were linked to substituting "macro" expressions back
into the original input line.
I've been using awk/gawk for one-liners and short scripts for over 30 years,
but this is the first time I've attempted anything this major. Once the
prototype is stable enough I'll most likely port it to a different language,
probably python, and provide a UI, but in the meantime awk is great for what I
need. Even in its unfinished state the app has already saved me hours of time
both at work and at home, and provided much enjoyment :)
Best regards,
Chris
-----Original Message-----
From: address@hidden [mailto:address@hidden]
Sent: 16 November 2019 18:35
To: Newell, Christopher (IE Dundrum); address@hidden
Subject: Re: Input line splitting and OFS
----------------------------- PHISHING ALERT -----------------------------
This email has been sent from an account outside of the BAE Systems network.
Be aware that this could be a phishing attempt. For more guidance, search
"phishing email" on Connect. If you think this is a phishing email report it
using the "PhishMe" button on Outlook.
------------------------------------------------------------------------------------
Hi.
"address@hidden" <address@hidden> wrote:
> Hi,
>
> I have a question about the use of OFS as it relates to field splitting.
OFS has been used to rebuild the record since awk was first invented
in the late 1970s.
As to "why?" I would have to guess that as OFS is used for output, and
most of the time the record is rebuilt in order to output it, that
using OFS made sense.
Additionally, as of 1987's "new" awk, when FS became it a regular expression,
using FS would make even less sense.
I hope this and the other answers have helped.
Thanks,
Arnold
BAE Systems will collect and process information about you that may be subject
to data protection laws. For more information about how we use and disclose
your personal information, how we protect your information, our legal basis to
use your information, your rights and who you can contact, please refer to the
relevant sections of our Privacy note at
www.baesystems.com/en/cybersecurity/privacy
<http://www.baesystems.com/en/cybersecurity/privacy>
Please consider the environment before printing this email. This message should
be regarded as confidential. If you have received this email in error please
notify the sender and destroy it immediately. Statements of intent shall only
become binding when confirmed in hard copy by an authorised signatory. The
contents of this email may relate to dealings with other companies under the
control of BAE Systems PLC, details of which can be found at
http://www.baesystems.com/Businesses/index.htm.