|
|
@ -29,24 +29,26 @@ $ |
|
|
|
|
|
|
|
|
|
|
|
### Hints |
|
|
|
### Hints |
|
|
|
|
|
|
|
|
|
|
|
`find` command is used to search and locate the list of files and directories based on conditions you specify for files that match the arguments: |
|
|
|
The `find` command is used to search and locate the list of files and directories based on conditions you specify for files that match the arguments: |
|
|
|
You can use REGEX in `find` command. |
|
|
|
|
|
|
|
|
|
|
|
You can use REGEX in the `find` command. |
|
|
|
|
|
|
|
|
|
|
|
```console |
|
|
|
```console |
|
|
|
$find ~/ -iregex '<REGEX>' |
|
|
|
$ find ~/ -iregex '<REGEX>' |
|
|
|
<all files and folders in the user home that respect the specified regex> |
|
|
|
<all files and folders in the user home that respect the specified regex> |
|
|
|
$ |
|
|
|
$ |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
REGEX for txt files: `.*\.\(txt\)` |
|
|
|
REGEX for txt files: `.*\.\(txt\)` |
|
|
|
|
|
|
|
|
|
|
|
`cut` command is a command-line utility that allows you to cut out sections of a specified file or piped data and print the result: |
|
|
|
The `cut` command is a command-line utility that allows you to cut out sections of a specified file or piped data and print the result: |
|
|
|
|
|
|
|
|
|
|
|
```console |
|
|
|
```console |
|
|
|
$cat cut-example.txt |
|
|
|
$ cat cut-example.txt |
|
|
|
abc-lol |
|
|
|
abc-lol |
|
|
|
testtest-abcx |
|
|
|
testtest-abcx |
|
|
|
qwerty-azerty-x |
|
|
|
qwerty-azerty-x |
|
|
|
$cat cut-example.txt | cut -d "-" -f 1 # cut the lines with "-" as delimiter and print the first part. |
|
|
|
$ cat cut-example.txt | cut -d "-" -f 1 # cut the lines with "-" as delimiter and print the first part. |
|
|
|
abc |
|
|
|
abc |
|
|
|
testtest |
|
|
|
testtest |
|
|
|
qwerty |
|
|
|
qwerty |
|
|
@ -57,3 +59,7 @@ You may need to use pipes `(|)` and the logical operator `&&`. |
|
|
|
|
|
|
|
|
|
|
|
> You have to use Man or Google to know more about commands flags, in order to solve this exercice! |
|
|
|
> You have to use Man or Google to know more about commands flags, in order to solve this exercice! |
|
|
|
> Google and Man will be your friends! |
|
|
|
> Google and Man will be your friends! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### References |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Regex](https://www.computerhope.com/jargon/r/regex.htm) |
|
|
|