Removing blank lines in a file... - VMS

This is a discussion on Removing blank lines in a file... - VMS ; > Quick everyone! What is "1---1"?? > It's the expression for the last day of the previous month! Both the > month and the year are defaulted to the current values. . . . I never knew that (and I've ...

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 21 to 27 of 27

Thread: Removing blank lines in a file...

  1. Re: Removing blank lines in a file...

    > Quick everyone! What is "1---1"??

    > It's the expression for the last day of the previous month! Both the
    > month and the year are defaulted to the current values. . . .


    I never knew that (and I've been looking after VMS since 2.5).
    Incidentally, it seems to be a composite. "1--" seems to be the first of
    the current month (which makes sense), and the extra "-1" is one hour
    behind that. Converting dates to ISO-8601:

    PICARD-# a==f$cvtime("1--","comparison")
    PICARD-# show sym a
    A == "2007-12-01 00:00:00.00"
    PICARD-# a==f$cvtime("1---1","comparison")
    PICARD-# show sym a
    A == "2007-11-30 23:00:00.00"

    neat.

    ---------------------------------------------------------
    Tom Wade | EMail: tee dot wade at eurokom dot ie
    EuroKom | Tel: +353 (1) 296-9696
    A2, Nutgrove Office Park | Fax: +353 (1) 296-9697
    Rathfarnham | Disclaimer: This is not a disclaimer
    Dublin 14 | Tip: "Friends don't let friends do Unix !"
    Ireland

  2. Re: Removing blank lines in a file...

    On Dec 13, 7:19 am, Tom Wade wrote:
    > > Quick everyone! What is "1---1"??


    > I never knew that (and I've been looking after VMS since 2.5).
    > Incidentally, it seems to be a composite. "1--" seems to be the first of
    > the current month (which makes sense), and the extra "-1" is one hour
    > behind that.


    yeah, which is not as useful as adding one more dash

    $ write sys$output f$cvtime("1---1-","comparison")
    2007-11-30 00:00:00.00

    Which leads me to the 'leap year test' I posted years ago:

    $ LEAP = F$CVTIME("28-FEB-''year' +1-",,"DAY") .NE. 1

    But that's really over complicated, as this will do just fine (with a
    dash)

    $ LEAP = F$CVTIME("1-MAR-''year' -1-",,"DAY")
    and for the current year:
    $ LEAP = F$CVTIME("1-MAR- -1-",,"DAY")
    $ IF LEAP THEN ...

    This work of cours because in DCL true or false depends on the least
    significant bit wether binary or text is being tested. So "28" is
    false, "29" is true.

    But we are drifting away from the blank line stripping....

    When is someone going to compliment/berate me on the shortest program
    I've ever written which still performs a useful, requested task? Just
    2 characters!
    ( $ awk "NF" file.dat :-)

    Cheers
    Hein

  3. Re: Removing blank lines in a file...

    on 12-12-2007 22:38 Larry Kilgallen wrote...

    > Your opinion is not correct. The difference between FN and FS is
    > that FN provides an automatic Yank whenever required.


    Ok, foot in mouth, I stand corrected. Hmm, that doesn't sound right
    either...


    --
    Wilm Boerhout Zwolle, NL
    remove OLD PAINT from return address to reply

  4. Re: TECOing blank lines out of a file

    In article ,
    Kilgallen@SpamCop.net (Larry Kilgallen) wrote:

    > In article <47607CB8.7090705@comcast.net>, "Richard B. Gilbert"
    > writes:
    >
    > > I've only used TECO two or three times in my life but there are a few
    > > things that TECO can do quickly and easily; things that others cannot do
    > > or do only with great effort on your part. It is not an editor for the
    > > faint hearted and you're out of your mind if you don't backup your file
    > > before you start! An ill chosen keystroke can turn your file into garbage!

    >
    > But on VMS file system versioning takes care of backup automatically
    > unless you go out of your way to defeat it.


    EBfilespec for those systems which didn't support file system versioning?

    --
    Paul Sture

    Sue's OpenVMS bookmarks:
    http://eisner.encompasserve.org/~stu...bookmarks.html

  5. Re: Removing blank lines in a file...

    On Thu, 13 Dec 2007 10:21:53 -0800, Wilm Boerhout
    wrote:

    > on 12-12-2007 22:38 Larry Kilgallen wrote...
    >
    >> Your opinion is not correct. The difference between FN and FS is
    >> that FN provides an automatic Yank whenever required.

    >
    > Ok, foot in mouth, I stand corrected. Hmm, that doesn't sound right
    > either...
    >
    >

    Well, unless you have good balance.


    --
    PL/I for OpenVMS
    www.kednos.com

  6. Re: Removing blank lines in a file...

    JF,

    Actually, I use code much like this in most of my DCL procedures which have
    to open other files for input data. Sometimes you even want to skip the line
    if it starts with an exclamation point. In case there were several exclamation
    points, you'd want to "Collapse" the string and then select the first character
    and see if it was a "!". The same might be true if you have a program with
    lots of empty lines starting with $ Dollar signs.

    Good programming practise also takes care of first properly closing possibly
    open files before opening them again, and takes care of properly closing open
    files on a execution interruption like a CTRL-Y. I have been burned by this
    many times, so you really should always use a Close/Nolog before
    you Open . A If the file is already closed, CLOSE/NOLOG has not effect
    and doesn't even complain. And it would be good if your OPEN statements had a
    /ERROR= on them where in that subroutine you grabbed the value of $STATUS
    and used it to generate a custom error message for the user.

    Anyway, good work, JF, on providing the FREE code. You just beat me to it,
    that's all. I would have done the same. My Remove_Empty_Lines.com that I've
    used for years looks much like yours.

    .. fred bach music at triumf dot c a


    JF Mezei wrote:
    > Richard B. Gilbert wrote:
    >> I'll write one if you pay me! It's cheaper to do your own homework and
    >> you'll learn more!!!!!

    >
    > Watch out for that newfangled thing called open source, it can ruin your
    > revenu source !
    >


    Add this:

    $ CLOSE/NOLOG input
    $ CLOSE/NOLOG output
    $ ON CONTROL_Y THEN GOTO ENDLOOP

    > $OPEN/read input myfile.txt
    > $OPEN/write output yourfile.txt
    > $!
    > $LOOP:
    > $ READ/END=ENDLOOP input buffer
    > $ test = F$EDIT(buffer,"COLLAPSE") ! removes all spaces/tabs
    > $ IF test .eqs. "" then goto LOOP
    > $ write output buffer
    > $ goto loop:
    > $!
    > $endloop:
    > $close input
    > $close output
    > $write sys$output "Done"
    > $exit


  7. Re: Removing blank lines in a file...

    In article , Fred Bach wrote:

    > In case there were several exclamation
    > points, you'd want to "Collapse" the string and then select the first
    > character and see if it was a "!". The same might be true if you have a program
    > with lots of empty lines starting with $ Dollar signs.


    Does F$EDIT(string,"UNCOMMENT") get you where you want to be with that?

    --
    Paul Sture

    Sue's OpenVMS bookmarks:
    http://eisner.encompasserve.org/~stu...bookmarks.html

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2