Beware, printing carriage returns to your terminal will tend to result in puzzling output. Best to pipe the output to `cat -A` to see what is actually being printed.
On Tue, Dec 26, 2023 at 12:27 PM Fred H Olson <fhol...@cohousing.org> wrote: > I forgot to mention. I am using version 8.5 of coreutils on old > Ubuntu 16.04. I dont know if this "feature" has been addressed > in newer versions. If so, sorry. > > Also another new comment at end of message... > > On Tue, 26 Dec 2023, Fred H Olson wrote: > > > 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. > > Also I have since tried above (on file with CR terminated lines ) > head -n<num> <filename> > if num is big enough to span multiple CR terminated lines > some of the printed text can be after the next command prompt. Weird. > I have not tried this in a script yet. > > 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 > >