Reputation
1,538
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
4 11
Newest
 Informed
Impact
~83k people reached

Apr
23
comment Replacing regex “$” does nothing for some lines?
LC_ALL=C cat -A, or sometimes xxd -g8 -c32 is better, will show you what's really in the file. Try the LC_ALL=C cat -A on your file, I'm thinking those lines have odd line endings that render on your terminal as line breaks but don't include a \n.
Apr
20
comment how do i print every other line in text file
sed '$!N;D' with newline instead of semicolon for backlevel seds might be portable.
Mar
2
comment See content of sourced script
There's also set -v to see statements as they're read.
Mar
2
comment Need something that is faster than “wc -l”
mmap is going to get vastly better results on linux because it'll map to huge pages these days, and TLB misses are sloooowwwwwww.
Mar
2
comment Get exit status of process that's piped to another
Nice. For the function I might just do (read; exit $REPLY)
Feb
15
answered Deleting certain words from filename
Dec
3
answered advanced sed print + replace
Dec
2
comment advanced sed print + replace
You're right, of course. Started out brainless, continued that way. My apologies.
Dec
2
comment advanced sed print + replace
Oh, god. That's brainless enough I'm just going to delete it. Here: sed -ni '/test/w /dev/tty s//best/g; p' (w/ a newline after tty)
Nov
8
answered bodhi linux deleted lxterminal
Nov
8
comment I need to make a file undeleteable, but allow it to be modifiable and renameable
You can set the sticky bit on any directory you want.
Oct
23
comment “render” textfile with carriage returns (^M) and save output to file
Given the \r usage here sed 's,.*\r\(.\),\1,' or maybe awk -F$'\r' '{print $NF}' should do it. But in general showing text as your terminal emulator rendered it means running it through your terminal emulator, xterm -e cat file /dev/tty will at least not litter your main scrollback buffer.
Oct
10
comment Exit vim more quickly
@CodeMedic It's far and away the fastest if you've got nno : ; and nno ; :, though. (plus vno the same). I was dubious about the swap, but you'll never go back. :nno ,: :silent! unmap :<CR>:silent! unmap ;<CR> and :nno ,; :nno ; :<CR>:nno : ;<CR>:vno ; :<CR>:vno : ;<CR> support the odd yap@" and such.
Oct
8
comment How do I clean up vi and reinstall it completely?
Looks to me like you're using homebrew, does this link help?. This is from googling "/usr/local/Cellar" which I'd never heard of before. Perhaps your python is backlevel? I don't know.
Oct
8
comment Do hard links count as normal files?
@mikeserv See, I can spell pty and pts, and probably even ptmx on a good day, but that's about it. :-) at least the 5,0 node works everywhere I can find, it's the controlling-tty device type. I got it with just ls -l /dev/tty, guess I got lucky there.
Oct
8
comment Do hard links count as normal files?
@mikeserv but to actually answer your question (sorry for the wot), yes, every link is just another way to get to the underlying object.
Oct
8
comment Do hard links count as normal files?
@mikeserv A socket's a purely runtime entity. socket() creates an actual socket, bind() gives it a specific name, connect() connects a socket you made to some named socket. Different kinds of sockets use different kinds of names, e.g. Internet sockets use Internet addresses, but they all share common API (including read() and write(), it makes me sad that you can't open() a filesystem socket and have the OS or libc do socket() and connect() for you). man 7 socket has more, all the networking protocols do make for a fidgety manpage.
Oct
8
comment Do hard links count as normal files?
@mikeserv It's the make-a-socket program above, it just drops a socket link named "socket" in its current directory.
Oct
8
revised Do hard links count as normal files?
only non-symbolic links keep inodes around
Oct
7
revised Do hard links count as normal files?
added 69 characters in body