bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Feature Request: scanf-like parsing


From: William Park
Subject: Feature Request: scanf-like parsing
Date: Fri, 22 Jan 2021 00:29:20 -0500
User-agent: Mutt/1.10.1 (2018-07-13)

Another feature request:

To parse out simple thing like IP components, you can do something like
    IFS=. read a b c d <<< "11.22.33.44"

But, if data are buried in a mess, then it's very labour-intensive to
dig them out.  It might be useful to have scanf()-like feature, where
stdin or string are read and parsed according to the usual format
string.  I guess, it would actually be sscanf(), since 'read' builtin
reads a line first.  Since you're dealing with strings, only %s, %c, and
%[] are sufficient.

Where it would be used:
    - everywhere, really everywhere.  

Advantage:
    - You can concentrate on "business logic", and less time on
      bookkeeping.

-- 
William Park <opengeometry@yahoo.ca>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]