Questions tagged as 'bash'

3
answers

How to add line break using sed?

How to add a line break in a pipe-received output, using sed, only for cases that fit the established pattern? I used sed "s/.*oo.*/&\n/" to no avail. The default is OK, but the addition of the new line does not. I need to know wha...
asked by 31.07.2014 / 15:53
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

Copy batch files, renaming them with the original directory name

Suppose I have a directory structure organized as follows on my PC: Diretorio 01 Arquivo 01.jpg Arquivo 02.jpg Arquivo 03.jpg Arquivo 04.jpg Diretorio 02 Arquivo 01.jpg Arquivo 02.jpg Diretorio 03 Arquivo 01.jpg Arquivo 02.jpg...
asked by 22.07.2018 / 18:54
2
answers

Replace "[" with [using thirst

I'm trying to correct some formatting errors in a file and I have as input: "[""teste""]" And I wanted to get an output like this: ["teste"] I already tried this command but it gives me error: sed -i s/"["/[/g *.csv sed -i s/"]"/]/g...
asked by 25.10.2017 / 18:59
1
answer

Convert .log file to .txt in Bash

Hello, I would like to know how to convert a generated .log file into a container in Docker and convert it to a txt file using Bash.     
asked by 13.09.2017 / 15: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

How to send commands to the ruby interpreter from a Shell Script?

This is more out of curiosity ... I've seen some examples of what I want to do, but in Perl. I tried to find a way to do the same in ruby, but to no avail. I want a function to generate an MD5 hash from a word passed as an argument. The inten...
asked by 04.07.2016 / 04:03
2
answers

Shell / Bash - Script continues before finishing the line that is running

I have a shell / bash script that works perfectly for making backups, the problem is that I have large files that are giving problems in running the script. The script has to compress the file in tar.gz format and it does this, but when i...
asked by 09.08.2016 / 20:03
2
answers

Receiving file lines, and handling them (BASH)

I need a bash script that will read a file, recognize the delimiter (in the case ";") and store the values that are in the delimiters in variables, to later build a menu with the dialog ... What I have done so far is: #!/bin/bash file="Tare...
asked by 31.10.2015 / 22:13