Questions tagged as 'shell-script'

1
answer

How to create a script inside a program in the terminal?

I'm trying to develop a script to automate repetitive tasks I've been doing in the terminal. However. I can only create Scripts for Commands directly in the terminal, not for commands within the program. How can I create a SH that will...
asked by 06.10.2017 / 04:16
1
answer

What is the meaning of the symbol ":" and "\\"?

The example I do not quite understand is: cut -d : -f /etc/passwd | tr : \t What does the colon : and the two \ bars mean?     
asked by 08.12.2016 / 23:47
2
answers

Delete all rows that have a specific string

I would like to delete all rows that have the string Excluído , searching from a specific string to the end of another string. Example: <p class="FolderPath"> <table class="DiffTable"> <tr> &...
asked by 04.12.2015 / 14:11
2
answers

Extract only the name of a file from the full path

I want to make a shell script that receives a filename with its full path, for example /home/42/arquivoEscolhido.txt , and extract only the file name ( arquivoEscolhido.txt ), which would be everything after the last slash ( /...
asked by 30.11.2018 / 23:02
2
answers

Write text in Shell Script

I'm doing a Shell Script, and I have to write a lot of lines in a single file, how can I do it in a more automatic way? Well I started doing it in a very manual way: echo "primeira linha do arquivo" >> /diretorio/arquivo.txt echo "segund...
asked by 27.11.2018 / 00:18
3
answers

Collecting bulk information from files

I want to collect ctime, atime, mtime, and crtime from a considerable mass of files. As a partial solution, I put the following script: sudo debugfs -R 'stat <1055890>' /dev/sda1|awk -F': ' -v c='' -v a="" -v m="" 'BENGIN {} $1==" cti...
asked by 13.06.2018 / 16:31
1
answer

Command that Verify that a software is installed on Ubuntu

Script that checks whether software is installed on Ubuntu. If you have installed it continues with the command sequence. if you do not ask if the user wants to install anyway Example: if (programa1=Instalado, programa2=instalado); then c...
asked by 26.04.2018 / 21:55
1
answer

How to show only lines that appear more than x times. (shell script)

I am parsing a log file and I wanted to filter only lines that appear more than 10 times within the file. I just can not find a way to do this filter.     
asked by 22.11.2017 / 14:41
2
answers

Subtract shellscript input argument value

I have the script below that prints on the screen the even numbers from 1 to the input argument. #!/bin/bash for i in $(seq 1 ($1)); do if [ $(($i % 2)) -eq 0 ] then echo "$i \c" fi done For example, to script the script wit...
asked by 20.06.2017 / 06:25
2
answers

Use of Uniq

I have been researching without much success, something that I believe in theory to be very simple, but I did not find the right command. I have a LOG file with several information, but certain information is repeated, but only in a certain c...
asked by 24.03.2017 / 23:27