mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.2 KiB
54 lines
1.2 KiB
2 years ago
|
## head-and-tail
|
||
|
|
||
|
### Instructions
|
||
|
|
||
|
Create the script `head-and-tail.sh` wich will show the first and last lines of the file `HeadTail.txt`
|
||
|
|
||
|
- Where to look : https://assets.01-edu.org/devops-branch/HeadTail.txt
|
||
|
|
||
|
- What to use : `curl` and `head` and `tail`
|
||
|
|
||
|
- The output should be exactly like the example bellow but with the expected name
|
||
|
|
||
|
```console
|
||
|
$./head-and-tail.sh | cat -e
|
||
|
Hello My username is: <...>,$
|
||
|
so my passwd is: <...>$
|
||
|
$
|
||
|
```
|
||
|
|
||
|
### Hints
|
||
|
|
||
|
With `curl` you can get the content of the file from the url:
|
||
|
|
||
|
```console
|
||
|
$curl https://assets.01-edu.org/devops-branch/HeadTail.txt
|
||
|
<...>
|
||
|
$
|
||
|
```
|
||
|
|
||
|
`head` print the top N number of data of the given input. By default, it prints the first 10 lines of the specified files:
|
||
|
|
||
|
```console
|
||
|
$head file
|
||
|
<first 10 lines>
|
||
|
$head -1 file
|
||
|
<first 1 line>
|
||
|
$
|
||
|
```
|
||
|
|
||
|
`tail` print the last N number of data of the given input. By default, it prints the last 10 lines of the specified files:
|
||
|
|
||
|
```console
|
||
|
$tail file
|
||
|
<last 10 lines>
|
||
|
$tail -1 file
|
||
|
<last 1 line>
|
||
|
$
|
||
|
```
|
||
|
|
||
2 years ago
|
May you will need to use `pipe (|)` and `&&`.
|
||
|
|
||
|
> 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!
|