Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
0 answers
199 views

Why do BSD and GNU grep give different results here?

I distribute a slightly modified version of a public CSV file. To generate the modified CSV file I use a short one-line grep command: grep -Ev '^([A-Za-zA-Za-z]|[0-90-9]*),' input.csv Actual project ...
polm23's user avatar
  • 171
2 votes
1 answer
2k views

POSIX and Portability | shell scripts | grep -s, grep -q

I am all in for portability in regards to shell scripts. But I am unsure if I am overdoing it right now. In this example, we have a function called confirmation, which accepts the very first ...
Vlastimil Burián's user avatar
2 votes
1 answer
1k views

Availability of deprecated egrep and fgrep commands

Quite often I've seen answers mentioning that egrep is grep -E or fgrep is grep -F and using egrep or fgrep in their answers, even though these are technically deprecated. So I was wondering if ...
Guy's user avatar
  • 904
1 vote
3 answers
333 views

How to rewrite grep call from Linux to AIX

In my Linux system in fgrep I am using atributes -m 500 -C 0. But on AIX I didnt see these arguments. So how should I rewrite it? I just read to use awk instead of fgrep but I don't know how.
hudi's user avatar
  • 155
3 votes
4 answers
11k views

Test if command accepts a specific option

What is the preferred way to test if a command takes an option? What are the caveats? As a motivating example, at login my shell aliases grep to add several --exclude-dir options but this option is ...
Praxeolitic's user avatar
  • 1,688
4 votes
3 answers
25k views

Search string in many files on HP-UX

I need to find which files (they can have space in the filename) of a directory contains a string using only sh and system's commands (Perl is not an option). For a few files, this command works fine:...
Giovanni's user avatar