Post History
for file in in chapter-*.xhtml do sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" "$file" done This -ir tells GNU-sed so alter the file in place (-i) and use regexp-extended (-r). For line 12...
Answer
#4: Post edited
- ```bash
- for file in in chapter-*.xhtml
- do
sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" "$file"[]()- done
- ```
- This `-ir` tells GNU-sed so alter the file in place (-i) and use regexp-extended (-r).
- For line 12 substitute from word boundary an uppercase letter (1) followed by multiple uppercase letters (2) with no1 untouched, but the 2nd pattern replaced by lowercase (\L), and to repeat this procedure globally (/g).
- Note that this will turn USB to Usb, USA to Usa, UNO to Uno and so on.
- For reaching into subdirectories,
- ```bash
- find -name "chapter-*.xhtml" -exec sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" {} ";"
- ```
- Again, GNU-tools (find, sed) are assumed (as default on most Linux systems).
- ```bash
- for file in in chapter-*.xhtml
- do
- sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" "$file"
- done
- ```
- This `-ir` tells GNU-sed so alter the file in place (-i) and use regexp-extended (-r).
- For line 12 substitute from word boundary an uppercase letter (1) followed by multiple uppercase letters (2) with no1 untouched, but the 2nd pattern replaced by lowercase (\L), and to repeat this procedure globally (/g).
- Note that this will turn USB to Usb, USA to Usa, UNO to Uno and so on.
- For reaching into subdirectories,
- ```bash
- find -name "chapter-*.xhtml" -exec sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" {} ";"
- ```
- Again, GNU-tools (find, sed) are assumed (as default on most Linux systems).
#3: Post edited
- ```bash
- for file in in chapter-*.xhtml
- do
sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" $file- done
- ```
- This `-ir` tells GNU-sed so alter the file in place (-i) and use regexp-extended (-r).
- For line 12 substitute from word boundary an uppercase letter (1) followed by multiple uppercase letters (2) with no1 untouched, but the 2nd pattern replaced by lowercase (\L), and to repeat this procedure globally (/g).
- Note that this will turn USB to Usb, USA to Usa, UNO to Uno and so on.
- For reaching into subdirectories,
- ```bash
- find -name "chapter-*.xhtml" -exec sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" {} ";"
- ```
- Again, GNU-tools (find, sed) are assumed (as default on most Linux systems).
- ```bash
- for file in in chapter-*.xhtml
- do
- sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" "$file"[]()
- done
- ```
- This `-ir` tells GNU-sed so alter the file in place (-i) and use regexp-extended (-r).
- For line 12 substitute from word boundary an uppercase letter (1) followed by multiple uppercase letters (2) with no1 untouched, but the 2nd pattern replaced by lowercase (\L), and to repeat this procedure globally (/g).
- Note that this will turn USB to Usb, USA to Usa, UNO to Uno and so on.
- For reaching into subdirectories,
- ```bash
- find -name "chapter-*.xhtml" -exec sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" {} ";"
- ```
- Again, GNU-tools (find, sed) are assumed (as default on most Linux systems).
#2: Post edited
- ```bash
- for file in in chapter-*.xhtml
- do
- sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" $file
- done
- ```
- This `-ir` tells GNU-sed so alter the file in place (-i) and use regexp-extended (-r).
- For line 12 substitute from word boundary an uppercase letter (1) followed by multiple uppercase letters (2) with no1 untouched, but the 2nd pattern replaced by lowercase (\L), and to repeat this procedure globally (/g).
- Note that this will turn USB to Usb, USA to Usa, UNO to Uno and so on.
- ```bash
- for file in in chapter-*.xhtml
- do
- sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" $file
- done
- ```
- This `-ir` tells GNU-sed so alter the file in place (-i) and use regexp-extended (-r).
- For line 12 substitute from word boundary an uppercase letter (1) followed by multiple uppercase letters (2) with no1 untouched, but the 2nd pattern replaced by lowercase (\L), and to repeat this procedure globally (/g).
- Note that this will turn USB to Usb, USA to Usa, UNO to Uno and so on.
- For reaching into subdirectories,
- ```bash
- find -name "chapter-*.xhtml" -exec sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" {} ";"
- ```
- Again, GNU-tools (find, sed) are assumed (as default on most Linux systems).
#1: Initial revision
```bash for file in in chapter-*.xhtml do sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" $file done ``` This `-ir` tells GNU-sed so alter the file in place (-i) and use regexp-extended (-r). For line 12 substitute from word boundary an uppercase letter (1) followed by multiple uppercase letters (2) with no1 untouched, but the 2nd pattern replaced by lowercase (\L), and to repeat this procedure globally (/g). Note that this will turn USB to Usb, USA to Usa, UNO to Uno and so on.