10 votes
Accepted

How can I check if string exists in file

The -x isn't relevant here. That means (from man grep): -x, --line-regexp Select only those matches that exactly match the whole line. For a regular expression pattern, this is like ...
user avatar
  • 93.6k
7 votes

How to insert an ascii character in a line position?

With awk: awk -F: '{print $1$2"."$3$4"."$5$6}' -F: will set : as the field separator and print $1$2"."$3$4"."$5$6 will print fields $1 and $2 then print a . ...
user avatar
  • 16k
6 votes
Accepted

How can I delete specific string from a file

If all you need is to remove 324,(i.e. exactly: one whitespace then 324 then one comma ,) from the file, then use: sed 's/ 324,//' file And to edit the file itself(i.e. overwrite the original file)...
user avatar
  • 16k
5 votes

How to insert an ascii character in a line position?

If your inputs are actual MAC addresses, then perl has a Net::MAC module for that (available in Ubuntu via the libnet-mac-perl package): Ex. $ echo '01:23:45:67:89:AB' | perl -MNet::MAC -lne ' my $...
user avatar
4 votes

How to insert an ascii character in a line position?

Manipulating bash parameters You can do it by manipulating bash parameters, remove the colons, then insert the dots between 4-character strings. See the chapter about 'Parameter Expansion' in man bash ...
user avatar
  • 42.3k
3 votes

How can I delete specific string from a file

Since your input file appears to be TOML, you could consider using a TOML tool to manipulate it - it's likely to be more robust than using a strictly text based utility. The tool I'm most familiar ...
user avatar
3 votes

What is the chat command in linux?

Whenever you don't know what a command does, the first step is to check its manual with man command. In this case, you want man chat which will show: CHAT(8) System Manager's ...
user avatar
  • 93.6k
3 votes
Accepted

How can I use else for the first if command

Think of if elif and else as chain links, if is the beginning, elifs are the middle links and else is the end link. What you've written is "beginning, middle link, end link, end link". In ...
user avatar
2 votes
Accepted

grep command to get file list with concatenated custom text

\; is not needed with xargs ... The place holder {} is not set, so not used as expected but used as a literal string instead ... So you could use: grep -rl --include=*.php --include=*.html --include=*....
user avatar
  • 16k
2 votes

how to reference different physical drive on linux command line

Nope, that's the way to do it. In Linux, drives are mounted at a "mount point", which just looks like another directory in your root directory tree. You can access the drive by referencing ...
user avatar
  • 1,864
1 vote

Help Setting Up a MariaDB server

Looks like you missed a step in the installation process. After installing you need to configure mariadb 1st. Fatal error in defaults handling is about missing a configuration. See step 3 in the ...
user avatar
  • 279k
1 vote

Open multiple tabs in ubuntu file explorer from command line

On Ubuntu 22.04, you could try this:- nemo -t ~/Downloads ~/Pictures
user avatar
1 vote

What is the chat command in linux?

The chat program defines a conversational exchange between the computer and the modem. Its primary purpose is to establish the connection between the Point-to-Point Protocol Daemon (pppd) and the ...
user avatar
1 vote

How to find the directory of VSCode after snap installation

Try on one the devices listed by $ lsblk -ap | grep -E 'NAME|loop' --color=none ... check the mounted ones first (cannot provide examples, snap uninstalled!) Due to issues similar to this, I prefer ...
user avatar
  • 4,056
1 vote

How do I disable the touchpad when the lid is twisted or closed?

Made another variation acting on 'lid' and 'tabletmode' and just 2 rules catching the response from the ACPI events (use "%e" in the action, mind the quotes !): #!/bin/bash # toggle '...
user avatar
  • 211
1 vote
Accepted

How can I use montage to concatenate 3 images so that they form an "inverted triangle"?

I tested with three pictures with size 642x397 pixels. Simple method montage 00-splash.png 02-iso-testing_installed-new-version.png 05-select-device_warning-and-overview.png -tile 2x2 temp1.png ...
user avatar
  • 42.3k
1 vote

Crontab job that compresses file with timestamp

UPDATE: Thanks to steeldriver, This command works for me (I needed the '' before any '%') : # */30 * * * * date >> /var/log/myDate.log 0 2 * * * gzip -c /var/log/myDate.log > /home/...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible