Maybe an odd question, but I’m attempting to grep the output of a command to select just the matching word and not the line. This word also has a wildcard in it. The first and second sections of the command check the git log for a file and grabs the line pertaining to the date and time of creation. I…
Tag: bash
Remove extra quotation marks in the grep output
the above cammand is used to get an http link example: www.224.ngrok.io but the output is say www.224.ngrok.io” How can I remove the extra ” at the end? I tried editing the ” from the grep command but it doesn’t work. Answer You can use positive lookahead: (?=”)matches the ”…
(answerd) find command in Bash SH is not working as expected [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 4 y…
Linux bash to iterate over apache access_log files and send mail
I need a linux bash script which send me an email if any results appear in searches made in the apache logs. I have a very simple method (sentence) to look into SQL Injection attacks, which simply searches for some keywords used in SQLi. Is this: So now I would like to be able to launch it in several access_l…
Use a modified variable in bash script, trying to change git branch programatically
I’m playing around with my custom commands, and I’m currently trying to change a remote Git branch programatically using bash. The idea is this function will try to find the branch issue_X, if it does it switches, otherwise it creates and sets the remote origin. The problem is git branch -u origin…
Is there a way to retrieve the script path called by a user-defined command?
I’m a newbie in GNU/Linux and, for a project, I need to do some reverse engineering. At a given line in a script, there is a command: I’m almost sure the “dc” command was previously added to the path/simlink/(?) by a previous developper. When executed, the command allows to run a simul…
Remove lines are between two line numbers (or patterns) with sed [no duplicate]
I saw and read many topics about my problem, but they didn’t help me. a close topic to my problem but it didn’t help me: removing lines between two patterns (not inclusive) with sed Question: I have a text file and I want to remove lines are between two patterns. note1: between these patterns, i d…
bash list postgresql databases over ssh connection
I am doing some work on a remote Postgresql database. When I log into the server this command works on bash: $ psql -c “l” Remote login over ssh is possible using: But why doesn’t it work from this command? This is working, also “psql -l” but I don’t understand why I have t…
Delete certain columns and add horizontally in AW. So many columns that I cannot type each one
I have been struggling more than a day and I cannot make my script work. Please help. My txt file extends to 500 columns. I need to delete columns 5,9,13,21,…, always delete n=4 column. Then, after removing the columns I mentioned above, I need to add all the columns remaining, BUT NOT taking into accou…
Use bash -s with other arguments
I have install.sh script which is located in server. I want to write one line code to download and run the script. Everything works fine until I am trying to set arguments It can’t recognize ‘-p’ as an argument but ‘abc’ can. How to set arguments in this situation starting with &…