Questions tagged [sed]
Sed stands for Stream EDitor - one of the basic tools in the POSIX environment. It processes one or more files according to an editing script and writes the results to standard output. Created in Bell Labs, it has been around since mid-70s.
281 questions
1
vote
5
answers
563
views
Remove commas in double quotes from CSV
I have a comma separated line I am using awk to extract fields from.
Server1,poweredOn,10.0.18.70,"Blue, Green",POC,Vsphere
However, when it comes to the text in double quotes ("Blue, ...
0
votes
3
answers
252
views
Updating Kerio Connect mailserver.cfg's UpdateLastCheck with sed
I am trying to update the Kerio Connect's mailserver.cfg file on Ubuntu 20.04 with the current UNIX time so that it synchronizes correctly with a second backup server.
I want to change the number ...
0
votes
2
answers
376
views
Format and filter ibm-mq queues
I need to display each IBM MQ Queue Manager queue along with its depth.
I can do this with a command like echo DISPLAY QLOCAL(QE*) WHERE(CURDEPTH GE 0) | runmqsc QMNAME.
The output is similar to this:
...
0
votes
1
answer
214
views
using sed to replace a string between quotes '12h' by '3h'
I am trying to use sed to replace a string like '12h' by '3h'
sed -i 's/length_s = '12h'/length_s = '3h'/g' my_files
but it didnt work
0
votes
1
answer
123
views
Change item in Apache configuration file with `awk`
I am not an expert with awk tool. I must miss something obvious...
What works so far:
[root@checkmk ~]# awk '/^[[:blank:]]*SSLCertificateFile/ {gsub(/\/etc\//, "/not_etc/")} 1' \
/etc/httpd/...
0
votes
1
answer
588
views
sed + delete all comment lines and when line match specific word
I created this sed in order to delete the comment lines lines from fstab ( comment can ne with begin of space or TAB etc )
sed '/^[[:blank:]]*#/d' /etc/fstab
in my case I want to add also the ...
0
votes
2
answers
703
views
Bash script : Print all lines between two pattern in variables with slashes
I have a directory that looks like so :
/path/to/files/data-file.1
/path/to/files/data-file.2
/path/to/files/data-file.3
/path/to/files/data-file.4
/path/to/files/data-file.5
/path/to/files/data-file....
1
vote
2
answers
4k
views
How to remove all lines with the same public key from known_hosts?
Let's imagine the following scenario.
I have an host key ABCDEF1234 for a given hostname, so my known_hosts file looks like this (unhashed version):
example.com ssh-rsa ABCDEF1234
Now I connect to it,...
2
votes
2
answers
363
views
Convert lscpu output to row based format in excel/csv table format
I have the below data (lscpu output) for 1000 servers and I want the same in excel but in row format and not as in command output in columns
1.2.3.4 CHANGED
Architecture: ...
0
votes
1
answer
687
views
sed not working on large files. Any other options available?
Trying to insert a line feed on large files in UNIX when a text string matches. Any file around 1GB or less, it works. Anything over that size, it does not complete the replace. It appears to do ...
-1
votes
1
answer
272
views
Copy/Move Entire Line To End Of The Line Above
I have a file that looks like the following:
/path/to/a/very/long/path
0 0 0 0 0 0
I need to move the line starting with a number (this can be any value not necessarily 0) to the end of the ...
4
votes
1
answer
3k
views
How to correctly escape single quotes in AWK
It isn't clear exactly what more needs to be escaped in the following macro to allow it to be used with awk or sed on FreeBSD.
define(`RELAY_MAILER_ARGS', `TCP $h 2525')dnl
Here is an awk command ...
0
votes
1
answer
153
views
PHP Serialize AWK command speed up?
I've built an SQL migration script that will replace text in a MySQL dump file. Replacements would be easy with sed, but we must account for special serializations (PHP Serialize). The code below ...
1
vote
1
answer
365
views
awk pattern search with file input to search in another file
I am looking for some hints, how I could achive a better, more elegant, efficient solution.
So I've got a file containing a list of names.
names.txt:
Doe John
del Super Mario
van Hoppity Jenny
van der ...
0
votes
1
answer
1k
views
how can I extract a Version number from a website with curl and grep / sed?
I want to get the latets version number from this website:
https://www.mailpiler.org/wiki/download
so I do a curl to get the content and then just use a pipe to search for the string using grep
curl ...