Skip to content

Instantly share code, notes, and snippets.

@thaihust
Forked from umidjons/dos2unix.md
Created November 2, 2017 01:19
Show Gist options
  • Select an option

  • Save thaihust/b71f1174d09e844f943fabd81f5c7e71 to your computer and use it in GitHub Desktop.

Select an option

Save thaihust/b71f1174d09e844f943fabd81f5c7e71 to your computer and use it in GitHub Desktop.

Revisions

  1. @umidjons umidjons revised this gist Jul 21, 2014. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions dos2unix.md
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,11 @@ Wouldn't break if you had spaces in file names.
    find . -type f -print0 | xargs -0 dos2unix
    ```

    Convert only *.php files
    ```bash
    find . -type f -name "*.php" -print0 | xargs -0 dos2unix
    ```


    If it's a large directory you may want to consider running with multiple processors:
    ```bash
  2. @umidjons umidjons created this gist Jul 18, 2014.
    17 changes: 17 additions & 0 deletions dos2unix.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@

    Will recursively find all files inside current directory and call for these files dos2unix command. Would break if you had spaces in file name.
    ```bash
    find . -type f -exec dos2unix {} \;
    ```

    Wouldn't break if you had spaces in file names.
    ```bash
    find . -type f -print0 | xargs -0 dos2unix
    ```


    If it's a large directory you may want to consider running with multiple processors:
    ```bash
    find . -type f -print0 | xargs -0 -n 1 -P 4 dos2unix
    ```
    This will pass 1 file at a time, and use 4 processors.