New answers tagged

0 votes

Mac OS X Terminal Equivalent for Host Name Info

In addition to the hostname command in macOS's Terminal, you may also be interested by the following command: /usr/sbin/networksetup -getcomputername (They don't return the same field, hence they ...
Pigeo's user avatar
  • 11
2 votes

Replace last nonblank line with a command output

You could reverse the file and replace the first non-blank line printf -v new_line 'CONFIG=%s' "$(jq -c . config.json)" tac local.env \ | awk -v line="$new_line" ' !n &&...
glenn jackman's user avatar
1 vote
Accepted

Replace last nonblank line with a command output

I don't know about better (the best would be to know that it's the line that sets PARAM2 that needs replacing, but you specifically say "the last non-empty line"), but the ed editor is ...
Kusalananda's user avatar
  • 323k
1 vote

Write catalogue file names in to a file with additional string at the beginning end of a specific name

printf 'string1(%s)string2\n' * Would print a string1(filename)string2 line for each of the non-hidden files in the current working directory, sorted lexically, or fail with an error if there was no ...
Stéphane Chazelas's user avatar
1 vote
Accepted

Write catalogue file names in to a file with additional string at the beginning end of a specific name

Adding a string to the beginning and end is quite easy: $ ls file1.txt file2.txt file3.txt $ ls | sed -e 's/^/string1/' -e 's/$/string2/' string1file1.txtstring2 string1file2.txtstring2 string1file3....
terdon's user avatar
  • 235k
-1 votes
Accepted

bash get output from command

Because the output is on STDERR, the error file descriptor output. What I would do, to combine STDOUT and STDERR in bash: if softwareupdate -l 2>&1 | grep -q "No new software available&...
Gilles Quénot's user avatar
15 votes
Accepted

Why does `ls` in Linux and macOS show different owners (uid) for the same file?

From the Linux kernel documentation for the hfsplus module: Mount options uid=n, gid=n Specifies the user/group that owns all files on the filesystem that have uninitialized permissions structures. ...
telcoM's user avatar
  • 88.4k
0 votes

Changing default editor for markdown bash_profile

How did you install "sublime text" on your Mac? Did you download the Mac version? Since "open" on the Mac is unique to the Mac, this is more of a Mac "Finder" question .....
rr0ss0rr's user avatar
  • 332

Top 50 recent answers are included