<commit_before># Squeeze repeated characters
***
Classic use-cases:  
**Preprocess formatted output before cut command (ls -l | tr -s ' ' | cut -f 2, etc.)**  

## with tr command
| Complexity::white_check_mark: | Efficiency::white_check_mark: |
| ---------- | ---------- |
**The classic method**:  

:warning: The ```tr``` command don't accept file arguments as input, it only read standard input from ```<``` or ```|```.
```bash
tr -s 'a' < <file>
```
Argument syntax variants:
```bash
tr -s'a' < <file>
tr --squeeze-repeats 'a' < <file>
```
Unefficient input variant:
```bash
cat <file> | tr -s 'a'
```

## with sed command
| Complexity::warning: | Efficiency::white_check_mark: |
| ---------- | ---------- |

```bash
sed 's/aa*/a' <file>
```
Argument syntax variants:
```bash
sed 's/aa*/a/g' <file>
sed -e 's/aa*/a/g' <file>
sed -e's/aa*/a/g' <file>
sed -r 's/a+/a/g' <file>
sed -r's/a+/a/g' <file>
sed -r -e 's/a+/a/g' <file>
sed -r -e's/a+/a/g' <file>
```
Input variant:
```bash
sed 's/aa*/a' < <file>
```<commit_msg>Minor fixes<commit_after># Squeeze repeated characters
***
Classic use-cases:  
**Preprocess formatted output before cut command (ls -l | tr -s ' ' | cut -f 2, etc.)**  

## with tr command
| Complexity::white_check_mark: | Efficiency::white_check_mark: |
| ---------- | ---------- |
**The classic method**:  

:warning: The ```tr``` command don't accept file arguments as input, it only read standard input from ```<``` or ```|```.
```bash
tr -s 'a' < <file>
```
Argument syntax variants:
```bash
tr -s'a' < <file>
tr --squeeze-repeats 'a' < <file>
```
Unefficient input variant:
```bash
cat <file> | tr -s 'a'
```

## with sed command
| Complexity::warning: | Efficiency::white_check_mark: |
| ---------- | ---------- |

```bash
sed 's/aa*/a/g' <file>
```
Argument syntax variants:
```bash
sed -e 's/aa*/a/g' <file>
sed -e's/aa*/a/g' <file>
sed -r 's/a+/a/g' <file>
sed -r's/a+/a/g' <file>
sed -r -e 's/a+/a/g' <file>
sed -r -e's/a+/a/g' <file>
```
Input variant:
```bash
sed 's/aa*/a/g' < <file>
```
{'fraction_non_alphanumeric': 0.2607407407407407, 'fraction_numerical': 0.0009876543209876543, 'mean_word_length': 3.151639344262295, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3129596', 'n_tokens_mistral': 848, 'n_tokens_neox': 788, 'n_words': 228}