All Questions
298
questions
0
votes
1
answer
28
views
Dealing with whitespaces in file names after git grep -l
I'm trying to run the script below and I'm struggling with pathspec error when the filename has whitespaces.
I have already read some other posts around here, but since I am not an expert I was not ...
0
votes
0
answers
31
views
Grep’s result coloring, and right-to-left scripts
I have a text file with a single line that contains the single Yiddish word azoy, in Hebrew script: אַזױ. Then I grep for occurrences of the oy character, ױ.
(This is highly simplified of course, in ...
1
vote
0
answers
21
views
How to calculate GUI used memory widget value?
OS: Kubuntu 22.04.4 LTS x86_64
to display above:
neofetch --stdout |grep 'OS:'
GUI = Graphical User Interface
GUI used memory = see widget image below.
.
2nd method to display used memeory = 2211 MB =...
0
votes
1
answer
47
views
no-ignore-case in grep command
In man page of grep --no-ignore-case matching control has the following description:
Do not ignore case distinctions in patterns and input data. This is the default. This option is useful for ...
1
vote
0
answers
60
views
How to command pv (Pipe Viewer) to work with diff?
using:
OS: Kubuntu 22.04.3 LTS x86_64
diff (GNU diffutils) 3.8 Copyright (C) 2021 Free Software Foundation, Inc.
pv 1.8.0 Copyright 2023 Andrew Wood, pv = Pipe Viewer
commands to display above:
...
2
votes
1
answer
303
views
How to Print, when columns have spaces - awk?
Problem:
desired columns have text with spaces SAMSUNG MZNLN128HCGR-000H1
undesired columns have text with spaces, see VENDOR = M.2 SSD
awk only printing the first word.
awk not printing the column ...
3
votes
1
answer
119
views
Why can I ssh and return a result faster than Linux can with a bundled command?
I'm writing a short bash script that involves logging into roughly 100 nodes and counting the number of processes running in top with my username, and I'm trying to combine the ssh-related processes ...
1
vote
0
answers
210
views
How to use diff for files names, not file content, and echo "differences!"
Background:
While comparing 2 directories,
command1, from the internet:
diff <(find "$DIR1" -printf '%P\n' | sort) <(find "$DIR2" -printf '%P\n' | sort) | grep '^[<>]'
...
4
votes
2
answers
136
views
Why is `grep "^ *[^<]" <somefile.xml` giving unexpected results
Say I have a file containing some xml like so:
<headtag>
<firsttag>a string</firsttag>
<secondtag>a string</secondtag>
<subleveltag>
a line with no tag
&...
-1
votes
1
answer
169
views
write a efficient for loop in bash for multiple files (.PDB files)
I have problem with this script:
#!/bin/bash
for filename in /home/hb/pg/ensemble/pdbs/P24941/raw_pdb/*.pdb; do
grep COMPND $filename | grep "CHAIN:" -B 1 | sed 's/COMPND//g' | sed 's/...
0
votes
1
answer
2k
views
Using grep to search for files with a specific extension [duplicate]
I'm trying to recursively look for C Sharp files containing specific text using a bash prompt on Windows Subsystem for Linux.
If I type grep -l -i -r "public virtual List<" /mnt/c/mycode/*...
4
votes
3
answers
2k
views
How to check if a command is running currently? [duplicate]
I want to check if a command is running with the following if clause, but it's always true, whether command actually is running or not:
if [ $"(ps aux | grep curl)" ]; then echo is; else ...
0
votes
2
answers
604
views
How to combine tee, sed and grep?
I have a command after which I place | tee >(sed $'s/\033[[][^A-Za-z]*[A-Za-z]//g' >> ~user/filepath/file.txt) The tee is redirected to sed $'s/\033[[][^A-Za-z]*[A-Za-z]//g' which removes the ...
1
vote
1
answer
51
views
How do I correctly execute 'vim $(grep -rli pattern | sed 's/\(.*\)/"&"/')' in bash?
I am trying to edit files that contain text matching a regular expression with vim and use the following command in bash to do that:
vim $(grep -rli pattern | sed 's/\(.*\)/"&"/')
I ...
4
votes
3
answers
2k
views
Copying a path in the terminal with the keyboard
I often find that when using the command line, I need to copy a path that appears in the output of the last command. For example I might use find . | grep like this:
[user@localhost /tmp]$ find . | ...