[raspberry-vi] Re: editing scripts

  • From: Tim Chase <raspberry-vi@xxxxxxxxxxxxxxxxx>
  • To: "Glenn K0LNY" <glennervin@xxxxxxxxxxxx>
  • Date: Wed, 20 Jan 2021 14:31:44 -0600

tr -d < *.sh
and it errored with ambiguous *.sh
Apparently I cannot do this to everything in a folder?

You can only pipe a single source into standard in and get a single
source as output.  So you'd want to wrap them in a for-loop to
process each individual file, using something like

  for f in *.sh ; do tr -d '\015' < "$f" > "nocr_$f" && mv "nocr_$f" "$f" ; done


That loops over all the *.sh files, does the clean-up and puts each
result in a file with the same name, prefixed with "nocr_", then
moves that resulting file back atop the original.

-tim


=========================================================== 
The raspberry-vi mailing list 
Archives: //www.freelists.org/archives/raspberry-vi
Administrative contact: <mike.ray@xxxxxxxxxxxxxx>
-----------------------------------------------------------
Raspberry Pi and the Raspberry Pi logo are trademarks of the Raspberry Pi 
Foundation.

This list is not affiliated to the Raspberry Pi Foundation and the views and 
attitudes expressed by the subscribers to this list do not reflect those of the 
Foundation.

Mike Ray, list creator, January 2013

Other related posts: