Skip to main content

All Questions

Tagged with
-1 votes
3 answers
90 views

Delete 2-line paragraphs, keep 3-line paragraphs, maintain newline between all

On a Linux machine with GNU tools I have an ascii file that consists of only 2-line and 3-line paragraphs, each paragraph separated by a newline. All 2-line paragraphs are to be deleted so that all 3-...
stampeder's user avatar
16 votes
5 answers
1k views

How can UserA programmatically replace a text string within a file they own that's located in /etc?

A non-root linux user owns a text file that's located in /etc, where the non-root linux user does not have permission to create files. The non-root linux user can edit the file manually via vi without ...
Tortoise Pirate's user avatar
1 vote
3 answers
73 views

Bash: sum a number present in N lines before a given pattern

I have a kdenlive project file (which is basically a xml file) with a lot of text clips inside. I need to bulk edit the x coordinate of a certain text that appears multiple times. This is an example: ...
baiserekku's user avatar
6 votes
3 answers
644 views

awk: sort by first column then second; output unique 1st column once but all 2nd column

I have a two-column file that you can create as follows cat > twocol << EOF 007 03 001 03 003 01 137 12 001 11 002 01 002 02 002 03 001 02 002 04 137 94 010 21 001 01 EOF The resultant file, ...
bballdave025's user avatar
2 votes
3 answers
821 views

ARGV[] not accepting the argument

I have a shell script that I am trying to pass a date argument to ARGV[1] but the script is giving a blank output Here is the command: #!/bin/bash dt=$(date -d "yesterday" '+%m%d%Y') cat /...
NecroCoder's user avatar
-2 votes
3 answers
120 views

bash + how to verify folders under specific path are ended with number/s

I want to check the folder/s under /var/kafka that all them are ended with number otherwhile I will exit with error ls -ltr /var/kafka drwxr-xr-x 399 kafka kafka 28672 Nov 9 13:10 data6 drwxr-xr-x ...
yael's user avatar
  • 13.4k
-1 votes
3 answers
152 views

Replace new lines at end for those lines whose 2nd field in colon separated file span over to multiple line

I have got multiple files with different set of contents but the pattern is same across mulitple lines in different files. sample input file : cat -n test.txt 1 adjfkhjdhfkjd: ...
Ashis Sahoo's user avatar
0 votes
1 answer
535 views

Check if two IP addresses are in a range

Using bash or perl on a minimal installed Linux, I am trying to validate two IP addresses if there are in a range. I came across a bash script that works well, but the fact that it prints all the IP ...
Bruce Malaudzi's user avatar
2 votes
0 answers
100 views

Processing large blocklists with GNU Parallel

This is an ongoing project that has undergone a major update to speed up list processing. Here is the homepage for anyone interested! It processes lists defined in lists.json by transforming the list ...
T145's user avatar
  • 213
2 votes
1 answer
396 views

How can I pass variables from a Perl script to a Bash script?

I got the duty to make a fix to an ancient Perl script our company uses, I haven't even looked at Perl in about 20 years. So I want to pick up a couple of the variables, and dump them to the ...
BigHoss's user avatar
  • 21
1 vote
6 answers
935 views

Find and replace a multi line text file in another multi line text file

I fought with it for so long but I am now completely out of ideas. Maybe someone here will be able to help me. Here is what I want to achieve: file_1.txt: # Some comment some_variable="test" ...
Peksio's user avatar
  • 121
1 vote
1 answer
47 views

"Total In-/Out- coming connection awareness" - script?

once I had found a bash (or Perl maybe; it's so long ago, that I wasn't knowledgeable about bash enough to tell one set of hieroglyphs from another set so to speak) script that filtered the open files ...
von spotz's user avatar
  • 435
0 votes
0 answers
514 views

base64 decode as save as multiple files

I have a file(har file saved from web developer" that contains the base64 encoded value of multiple video*.ts files. I am interested to decode the base64 part and save as multiple ts files if the ...
maneesh murali's user avatar
3 votes
2 answers
282 views

Find regex occurrances on block device (line length buffer issue)

I'm trying to find all numbers on two block devices that start with a # character, are between 1635700000 and 1653699999, and end either with a null character (\0) or a linux newline (\0xA). I came up ...
user1902689's user avatar
  • 1,218
0 votes
4 answers
371 views

extract and compare block of text

I have a data gethered in one file organised in blocks ---- BLOCK ONE ---- some data another data more data more data ------------------- ---- BLOCK two ---- some data another data -------------------...
eswues's user avatar
  • 3

15 30 50 per page
1
2 3 4 5
11