mac_newline_delete

A bas script that uses sed to globally delete Mac newline characters.

 
 

% mac_newline_delete
Usage: mac_newline_delete file.1 new_file
arg1 - name of file to be corrected
arg2 - name of new (corrected) file   

% mac_newline_delete a CC

This is a simple code, but I always foregt the sed call. Here is the script code:

 
 
#!/bin/bash
# Use the unix sed task to remove Mac newlines

if [ -z "$1" ]
then
printf "Usage: mac_newline_delete file.1 new_file\n"
printf "arg1 - name of file to be corrected\n"
printf "arg2 - name of new (corrected) file   \n"
exit
fi
if [ -z "$2" ]
then
printf "arg2 - name of new (corrected) file   \n"
exit
fi

sed 's/^M//' $1 > $2

# To get this entered properly above, I had to do:   cntrl-v cntrl-M




Back to scocodes page