Linked Questions

77 votes
8 answers
56k views

I want to determine which process has the other end of a UNIX socket. Specifically, I'm asking about one that was created with socketpair(), though the problem is the same for any UNIX socket. I ...
Jonathon Reinhart's user avatar
29 votes
4 answers
2k views

Using gawk -i inplace some-awk-code some-file (or @include "inplace" within an awk script) to edit a file in-place (or any other extension) is a security vulnerability. Why? How do I work ...
Stéphane Chazelas's user avatar
24 votes
2 answers
64k views

I have a parent folder named "parent_folder" with a lot of subfolders, in these subfolders is a file named "foo.mp4". I can find these files easily by doing this: mymacbook:parent_folder username$ ...
dubbelj's user avatar
  • 343
2 votes
2 answers
3k views

I need to delete all lines in a file, if the values in all the columns are 0 (so if the sum of the row is 0). My file is like this (13 columns and 60000 rows, tab delimited) KO gene S10 S11 S12 ...
Francesca de Filippis's user avatar
0 votes
2 answers
4k views

As I understand it: ./filename executes filename as a script. ./ indicates the current directory. What purpose (if any) does the ./ serve if precedes a glob qualifier (filter): qpdf --empty --pages ....
gatorback's user avatar
  • 1,532
2 votes
3 answers
648 views

I would like to move files in existing directory files containing specific content to an existing or new directory and subdirectory by writing a script called fruit in ~/bin that moves them to dir/...
yosif's user avatar
  • 21
0 votes
4 answers
4k views

In a single directory, I'd like to replace the first line of each file with the file's name. Each file has as the first line "TestRelation." I'd like to replace it with the file's name. I know I can ...
Adam_G's user avatar
  • 433
1 vote
4 answers
3k views

I'm trying to replace a character in a file at a random position. My file looks something like: aab babab abab I'm trying to replace a random character for 'c'. So the output might look like: ...
user3891532's user avatar
0 votes
2 answers
727 views

I found that we can use perl -wnle "/RE/ and print" such as perl -wnle "/^.{0,80}$/ and print" or grep -ri someText * | perl -wnle "/^.{0,80}$/ and print" to exclude lines longer than 80 characters....
nonopolarity's user avatar
  • 3,319
2 votes
4 answers
302 views

I have a text file with accounts like: Input Sample Paid 100 15/02/2022 3000 recd 50 15/02/2022 nelur trip 3050 PAID 80 25/03/2022 Adjusted towards trip 3130 14 PAID 50 26/03/2022 Given to Nate Cash (...
tgkprog's user avatar
  • 249
1 vote
2 answers
163 views

I'm trying to bowdlerize email addresses in a fixed length text file by generating a random string the same length as the input. I'm passing the string as a backreference in sed. To simplify, this ...
Paul Joiner's user avatar
0 votes
1 answer
170 views

Background: (1) I have a data set of scientific notation: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.503832e-05, 1.433673e-05, 2.557402e-05, 3.081098e-05, 4.044465e-05, 2.480817e-05, 2.681778e-05, 1....
nam's user avatar
  • 137
0 votes
2 answers
117 views

The following awk code wraps lines at the 72 column: awk -v maxLen=72 ' { out = sep = "" for ( i=1; i<=NF; i++ ) { nextOut = out sep $i if ( ...
jsx97's user avatar
  • 1,357