Questions tagged as 'shell-script'

3
answers

Grep with multiple parameters

I need to select the rows of a file that contains the characters | or \ diff -y ontem.csv hoje.csv | grep -e "|" -e "\" How to tell pro grep to return the rows it contains either a | or a \ ?     
asked by 05.07.2018 / 19:49
2
answers

Store paths containing directory with space in the name

Personally I have the following problem: I need in my script to store a path of an X directory in a variable. The big problem is that one of the folders in this path contains space in the name and for some reason when calling the variable it giv...
asked by 27.10.2016 / 14:47
2
answers

Deleting rows only if any cell in the worksheet is blank (using a script)

I have a calc (libreoffice) / Excel spreadsheet (it's actually a text file I opened as a spreadsheet for easy viewing) that contains some blank cells (not the entire line): I would like if some cell on the right is blank, the entire row...
asked by 28.05.2017 / 17:04
2
answers

Correct invalid command dynamically, without aliasing

I'm using GNU bash version 4.3.46 . One problem I have when typing commands is that I often forget a space between the command and its parameters. Examples: cd.. gitlog When the correct one should be cd .. and git log , res...
asked by 21.05.2018 / 14:44
2
answers

swap shell commands

The command python foo.py When called on the terminal, it runs the sent python file. Imagine that I have a python file that always needs to be called as follows: xvfb-run python foo.py to work. Is there any way I can write something...
asked by 27.05.2015 / 14:40
1
answer

Help with shell script and regular expressions

I'm doing this shell script code that should pass each line of a text file, and determine if the sentence is positive or negative depending on the IF condition #!/usr/bin/ksh file="${1}" while read line;do pos=$(grep -oP ':\)|;\)|:D'...
asked by 12.11.2015 / 19:47
2
answers

How can I change the file extension recursively in GNU / Linux?

I'm trying to get all the .sql files from my project and change the extension to .md . I've already been able to do this, however, the files are being moved to the root of the system, which is the path where the shell script is. How...
asked by 21.11.2018 / 14:03
1
answer

How to sort a column of a file without sorting the rows?

I have a file that has three columns, and several rows. The second column is made up of numeric values, and I want to rearrange it, in ascending order, but without affecting the previous and subsequent column. exemplo do arquivo: 7.31937 736...
asked by 11.10.2016 / 15:29
1
answer

Edit configuration file

I have a configuration file with several parameters, for example: campo1=valor campo2=valor campo3= I would like to assign a value to campo3 with Shell Script. I tried to awk but could not. The value to be replaced will hav...
asked by 17.08.2018 / 20:16
2
answers

Find and Replace in bash

I need to find outdated rows in a csv file and replace them with new rows. These are the commands that find the lines that are going to be replaced (old) and that will replace (new) lines. linhas_antigas=$(diff -y arquivo_com_linhas_antigas...
asked by 21.06.2018 / 20:12