Overview
sed is a stream editor. It is used to perform text transformations on an input stream, such as a file or a pipeline. Files created on the Windows operating system contain line breaks that can prevent scripts from running on a Linux operating system.
Removing Line Breaks
To remove the line breaks generated by Windows, run sed with the following operation.
sed -i 's/\r//g' sample.shSummary
The sed command takes the operation to perform in single quotes, followed by the file. The s stands for substitution. The slashes / delimit the pattern to search for and its replacement. In this case, \r, the carriage return of the Windows line break, is replaced with nothing. The g flag instructs sed to search for all occurrences.