Skip to main content

All Questions

Tagged with
0 votes
1 answer
37 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
  • 309
-1 votes
2 answers
62 views

extract multiple words from git log

I need to extract multiple words from git log. I need the commit id and ticket number for each commit, I then need to run this through a loop and do some further processing for each commit. commit ...
xerxes's user avatar
  • 331
3 votes
2 answers
113 views

What explains this very odd behavior of GNU grep interacting with buffering and pipes and how to stop it?

This is best illustrated with an example I feel: { printf 'foo\nbar\n' ; sleep 2 ; } | grep -m1 foo { printf 'foo\n' ; sleep 2 ; printf 'bar\n' ; sleep 2 ; } | grep -m1 foo Both of these commands, ...
Zorf's user avatar
  • 171
0 votes
5 answers
104 views

Why can't add the header in the df's output?

Get all processes whose name contain firefox and exclude grep process,it is no use to show all processes here,omit many lines. ps aux | grep [f]irefox debian 7069 1.0 4.4 3134148 359168 ? ...
showkey's user avatar
  • 437
-1 votes
2 answers
67 views

set output into variable from grep from input variable

whats wrong with this bash script: acme2=$(dig txt @$1 _acme-challenge.$1.de) acme3=$(echo $acme2 | grep "^_acme") ...
dg1kpc's user avatar
  • 1
0 votes
4 answers
172 views

bash - slice quoted substrings delimited by spaces into array

following example: string=" 'f o o' 'f oo' 'fo o' " array=($string) echo "${array[0]}" outputs: 'f while the expected output is: 'f o o' The only solution I came with is by ...
Zero's user avatar
  • 39
0 votes
2 answers
131 views

variable assignment doesn't create one same object at least for grep

The problem is as follows (Here I don't use find since it doesn't support double-asterisk wildcard **): $ FILES=(foo/**/*.suffix bar/**/*.suffix2) $ grep baz "${FILES[@]}" # works # I use ...
An5Drama's user avatar
  • 173
0 votes
0 answers
40 views

How to ALSO print the first line using grep [duplicate]

I quite often find myself using grep in cases where it would be very handy to have grep print the first line of the result along with the matched lines. This is not limited to Kubernetes (I'm not ...
MikeKulls's user avatar
  • 164
1 vote
2 answers
90 views

Need to identify executable files via boolean shell test construct

I am trying to symlink executable files to a bin directory within a docker script. I need a way to identify executables and return boolean status. I've been trying this: for i in ../src/u-boot/tools/...
mreff555's user avatar
  • 131
0 votes
2 answers
44 views

Capture and print on the exact match from a file

I am trying to use grep to match only a specific part of a row in a file. The file is a huge csv file with some columns containing json with commas so it is hard to figure out which column what I am ...
smith's user avatar
  • 161
-2 votes
4 answers
70 views

gnu grep multiple filters in one regex [closed]

RHEL 8, if it matters. I need to find all the rows in a text file which match these three filters: cut -f1 -d: .pgpass | grep ^FISP | grep -E 'CDS|TAP' | grep PGS401 FISPCDSPGS401A FISPCDSPGS401B ...
RonJohn's user avatar
  • 1,184
13 votes
3 answers
933 views

Inconsistent “unzip -l … | grep -q …” results with pipefail

The following Bash function gave inconsistent results: # $1 Path to ZIP archive. # Exits with 0 status iff it contains a “.mp3” or “.flac” file. mp3_or_flac_in_zip() { local archive=${1:?No ...
Alice M.'s user avatar
  • 389
-2 votes
4 answers
112 views

How to get either a substring or a text value using awk and if?

I can't figure out how to write a simple ping log. I only need either the ms value or the words "no connection". I have myping=$(ping -c 1 10.0.10.1). I only need the value between "...
Gary U.U. Unixuser's user avatar
0 votes
3 answers
88 views

Need to make multiple multiline replacements in file

I have a file with multiple "paragraphs" like this: <type>TRANS</type> <attributes/> <specification_method>rep_name</specification_method> <trans_object_id/&...
Todd Porter's user avatar
-2 votes
2 answers
138 views

How to diff two files in bash efficiently?

I have two files containing the similar pattern: cmd1 [cmd2 {xx/xx[7] x/x[0] ...}] cmd3 [cmd4 {xx/x[12] ...}] cmd5 [cmd6 {x/x[1] xx ...}] I don't need to consider all the cmds in two files. Only need ...
Alan Gatsby's user avatar

15 30 50 per page
1
2 3 4 5
49