Skip to content

Willy65/LFCleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note:

Using linux 'awk' it is easy to determine the number of fields

in a record.

LFCleaner

Utility to strip bogus linefeeds from CSV records and outputs repaired data
We pass a lot of CSV data in the format of:

pattern;[data_1];[data_2];[data_4];[comment-1];LF (linefeed)
pattern;[data_1];[data_2];[data_5];[comment-2];LF (linefeed)
pattern;[data_1];[data_3];[data_6];[comment-3];LF (linefeed)

Every now and then, a user puts in an extra LF (linefeed) in the [comment] field like:

pattern;[data_1];[data_2];[data_4];[comment-1];LF (linefeed)
pattern;[data_1];[data_2];[data_5];[comLF (bogus linefeed in comment field) 
ment-2];LF (linefeed) pattern;[data_1];[data_3];[data_6];[comment-3];LF (linefeed)

This breaks the receiving end.
It doesn't know how to deal with [com(LF)ment-2] instead of [comment-2].
This C utility can strip those bogus linefeeds, as long as every CSV record has a distinct heading.
Exitcode = EXIT_FAILURE if a bogus linefeed is found.

Errors / warnings are sent to stderr.

The output is the repaired input.

About

Utility to strip stray linefeeds from CSV records

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published