trimmer - new cplusplus project

Aug 06, 2016 16:02


trimmer - new cplusplus project

In working with x12 834v5010 sample files, to use for testing nc_834v5010generator, I notice that sometimes the files have unnecessary whitespace padding either at the beginning of a segment, before the segment ID, or after the segment terminator.

After researching for *nix text utilities, I did not find a simple program that does what I want. I could use things like regular expressions, but seems like overkill for what I need.

What I basically need is, a program that does boost::trim(strValue) on each line of a text file, so the output lines have any front-side or rear unnecessary whitespace removed.

a line of text file that needs trimming " DTP*blah*blah*blah~ " after trimming, should be "DTP*blah*blah*blah~"
Originally, I thought any program I make would take a filename as an argument, but I think I'd rather have it use pipes, so I can just "cat filename | trimmer > trimmedFileName."

Yesterday I started the project, but hadnt decided on using pipes. Project sourcecode is online at http://mrflash818.geophile.net/software/trimmer/.

Whatever I create, will be open source, GPLv3.

2016-08-06 After a bit of research, seems debian has many of the utility programs, like wc, in a package called coreutils. Downloaded the sourcecode for debian's coreutils, so I can see how the program wc, and others, accepts piped input.

2016-08-14

One of the magic functions that allows a program to accept input via piplining, that I used for my solution, is fgetc(stdin).

linux, debian, 2016, open source, trimmer, cplusplus, programming

Previous post Next post
Up