coreutils
[Top][All Lists]
Advanced

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

head and file with CR line terminators


From: Fred H Olson
Subject: head and file with CR line terminators
Date: Tue, 26 Dec 2023 10:51:08 -0600 (CST)

I'm using the command:
head -n1
on all the 12,000+ text files in my system (!)

I have a few with CR line terminators (old Mac files?).
I used the command "file" to identify and make a list of text files
and created a long linear (12000+ lines) script that does something like:

head -n1 <filename1>
head -n1 <filename2>
etc

With this script, if a file has CR line terminators all of
the file is printed instead of just the first CR terminated line.

>From the command line with such a file
head -n1 <filename>
for one example file that command prints about 100 characters with
snippets (10-32 characters long from 6 various CR terminated lines
(none of the first (CR) line) is printed.

Is there a way (short of reformating such files) to get head to
display just one CR terminated line?

For now I'll try treating CR terminated lines separately and just print
a limited number of bytes.

I use my own system of organizing text files and having hyperlink like
links between them and am trying to develop a way to make a list such
files. I use some "magic" like strings mostly on line one and may try
teaching "file" to identify them but for now am examining the first
lines of text files

I do not subscribe to this list so a direct cc of replies would be
appreciated.

Fred

--
Fred H. Olson  Minneapolis,MN 55411  USA        (near north Mpls)
     Email:        fholson at cohousing.org      612-588-9532
My Link Pg: http://fholson.cohousing.org



reply via email to

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