Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
5 votes
3 answers
509 views

Can grep output the complete input verbatim only if there was a match?

I'm processing input data in a pipeline consisting of several programs. In one step of the pipeline, I want to know if there are certain lines in the input, but I want to output everything as-is ...
bitmask's user avatar
  • 1,246
-2 votes
2 answers
123 views

Counting unique IP addresses per hour in existing log files

I am trying to determine the number of unique web visitors to my website each hour. The log files (access*.log) contain many lines looking similar to this. 192.168.211.85 - - [29/Sep/2024:10:17:02 -...
kojow7's user avatar
  • 305
1 vote
0 answers
159 views

get unique lines from a file [closed]

For reference, this is a follow-up on @EdMorton's answer to my previous question: make master/slave ip in different subnet I have a file have duplicates on both first column and the second column,just ...
peng xiao's user avatar
1 vote
3 answers
162 views

make master/slave ip in different subnet

For reference, this is a follow-up and variation on group ip address to different subnet with shell We have two strings (named master/slave), the two strings are composed with IPS spread in three ...
peng xiao's user avatar
3 votes
1 answer
302 views

grep return "No such file or directory" after command substitution

I'm trying to use grep in a bash script and assign the result to a variable: RESUlT=$(grep -R -I --exclude-dir=addons "^[^#]*print(" ) But it returns bash: Map/Places/place.gd:: No such ...
T.S's user avatar
  • 33
-2 votes
3 answers
420 views

Bash script: echo output of variable and write to file

I am trying to write a script which will check to see if the contents of a file match a certain value and if so, overwrite it with contents of another file. Example: file1 = A, B, C, D 1, 2, 3, 4 ...
Joseph Woodward's user avatar
-1 votes
1 answer
145 views

zgrep command not working correctly on command substitution [duplicate]

I am preparing a script that will try to detect two texts on the same line.  This pattern is present in my application log files, which then further used to identify which file contains the pattern. ...
Piyush Nikhade's user avatar
1 vote
1 answer
103 views

What does "/$" mean to "grep"?

I'm using these two codes below. ls -lap . | grep -v "/$" ls -lap . | grep -v "/" These two give me different outputs in some cases. What does $ mean in that context?
shersher's user avatar
0 votes
2 answers
343 views

i3 command to toggle picom that greps ps for "picom" works when it should fail, as "picom" is in the command and shows up in "ps" output

I have this line in my i3 config: bindsym $Super+Shift+F10 exec --no-startup-id ps aux | grep -q '[p]icom' && killall picom || picom It runs a shell command (everything after --no-startup-id ...
mutageneral's user avatar
0 votes
2 answers
159 views

Unable to grep foreign language in shell script

I am a newbie in shell scripting, I have a text which contain text in following format:- "some foreign language",'corresponding ID to text' for example:- "Назад",...
tabish's user avatar
  • 520
0 votes
2 answers
431 views

How to grep for the value of a variable inside a shell script?

I have 2 files: a file full of values I want to look for my source text file I wrote a short shell command to loop thru my list of values and grep against my source file. If it doesn't find the ...
Classified's user avatar
0 votes
2 answers
353 views

Passing multiple includes that contain spaces to grep

I'm creating PowerShell and Bash scripts to standardise our usage of the former's Get-ChildItem and Select-String and the latter's grep. As part of the Bash script, I'm taking command-line arguments, ...
mythofechelon's user avatar
1 vote
2 answers
350 views

Remove exact line from file if present, leave the rest of lines; error-handling - how to go about it

I am not exactly sure how text processing should be done in a good way, so let me ask. I have this file: ~/.config/mpv/input.conf containing possibly other options as well as v disable. If I want to ...
Vlastimil Burián's user avatar
0 votes
1 answer
386 views

How to assign output of Grep in a Variable

I am trying to assign the output of grep in a variable . The below command provide me the correct output in a script str="DWMessStage-20230609-083501.xml__a6e27c1.4a73a37b.13.1889d3efa14.N7f9d....
Shuvra Maitra's user avatar
0 votes
0 answers
207 views

Batch extract pdf from emails on Debian in bash

What I'm trying to achieve: I am trying to send pdf documents to my Remarkable 2 tablet via email. How I'm trying to do it: I set up rmfakecloud: a software that runs on your server and emulates the ...
giovi321's user avatar
  • 919

15 30 50 per page
1
2 3 4 5
33