Skip to main content

All Questions

Tagged with
1 vote
1 answer
44 views

How to Preend or Append File Name to Reflect Number of Pages in PDF using "qpdf" and "perl"

I am running the script at the bottom as a one-liner but have expanded for ease of reading. Assume the directory contains the following file: File (11).pdf. When the script executes, it simply repeats ...
Brian's user avatar
  • 1,045
1 vote
1 answer
116 views

Using sed to edit filepath variable

I am trying to use the sed command to edit a value in the .git/config file. When running the remote origin command, the config file creates the line of text like this": url = https://github.com/...
Abbatrombone's user avatar
1 vote
1 answer
95 views

How to merge all mp3 files located in the same directory?

The command below used to work but stopped around ubuntu/kubuntu 20.04. ls *.mp3 | sed -e "s/\(.*\)/file '\1'/" | ffmpeg -protocol_whitelist 'file,pipe' -f concat -i - -c copy output.mp3 ...
Cortez's user avatar
  • 11
0 votes
2 answers
105 views

bash + how to insert date before line

lets say I want to pipe the date output in the beggining of some text for example echo "this line is test line" | date and expected output should be Wed May 22 14:55:10 UTC 2024 this line ...
King David's user avatar
0 votes
1 answer
33 views

sed does not consume rest of the line

I have one line of different words stored in a txt file N/A 9.0 Yes Yes N/A N/A N/A N/A 8.8 Yes Yes N/A N/A N/A N/A 8.7 Yes Yes N/A N/A N/A N/A 9.2 Yes Yes Yes Yes Yes Yes 9.1 Yes Yes Yes Yes Yes Yes ...
Cobra Kai Dojo's user avatar
-1 votes
1 answer
81 views

Search and replace doesn't work with sed busybox. getting sed: unmatched '/' error

I am trying to search a particular string and replace all occurrences within a file. sed -i -e "s/$search_string/$replace_string/g" $filePath I keep getting sed: unmatched '/'error on ...
aelor's user avatar
  • 99
0 votes
2 answers
83 views

Find and replace date with UTC date

I have file that looks like this: [2024-01-20 15:23:00] hello world [2024-01-20 15:42:00] bye [2024-01-20 15:43:00] foo bar ... Date in this file are in UTC+1 and I want to convert in to UTC I tried ...
sloppy's user avatar
  • 3
0 votes
1 answer
47 views

How do I tell sed to stop trying to process commands?

Maybe I'm an idiot (this is the likely scenario, and I'm new to sed/bash scripting), but why does this work: NewVersion="$(echo $NewVersionFile | sed 's/^.*-\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/')&...
sirphillystax's user avatar
0 votes
1 answer
590 views

Moving files to a directory with spaces in its name

I'm trying to create a directory that has in its name the beginning of the names of the files it contains. I need this in order to archive it later. I have run into problems when moving files if the ...
user avatar
0 votes
2 answers
1k views

Find and replace string in a file using 'sed' or 'awk'

Let's say I have the following input file: yhara.runner.mng1.nna1.X9HCJG.1 yhara.runner.mng1.nna1.Z2HCJG.1 100.000 100 yhara.runner.mng1.nna1.X9HCJG.1 yhara.runner.mng1.nna1.AUEM0K.1 94.144 72 ...
denny's user avatar
  • 103
0 votes
0 answers
108 views

How do I perform this sed command with bash?

I have a file full of usernames and I want to use sed to change the usernames to PLAYER 1-20 how can I do this with a bash script and sed while incrementing? I have this so far: NAME=$(grep -q 'Seat' $...
Mugiwara's user avatar
-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/...
shahed's user avatar
  • 9
1 vote
0 answers
357 views

Sed editing of large text file much faster than native bash substring replacement?

I have a ~19MB text file which I would like to perform many find/replace operations on. I originally wrote the script to loop over inplace sed operations e.g. sed -i "s|$pattern|$replacement|g&...
Neuromancer's user avatar
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 ...
qwerty's user avatar
  • 11
1 vote
2 answers
609 views

Delete lines between two patterns (with multiple occurrences) around a third pattern (single occurrence)

I'm trying to edit an uncompressed PDF on macOS Monterey, and I want to delete objects that contain a certain pattern in their description. Such objects start with "X 0 obj" (where X is the ...
Lucuma13's user avatar

15 30 50 per page
1
2 3 4 5
25