Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by Eric Renouf
Print random lines respecting the order of the source file
I have a large text file (~500K lines) with short sentences (couple of words long). Additionally, there is some XML markup in most of the lines. Finally, the text file has been sorted before the markup has been added! Adding the XML markup changes the alphabetic sort but this is desired. My question is: How can I print random lines respecting the order of the source file? I know I could just use the shuf command and sort the result. The problem is that the markup will mess up the sort.
Unix & Linux Stack Exchange
The will take the output of the command on the left and give it to the input of the command on the right. The operator will take the output of the command and put it into a file. That means, in your example, by the time it gets to the there is no output left; it's all gone into .
Monitor if a process has terminated in C
I am writing a monitoring program in C, which performs the and cycle. However I need to check whether the child process has terminated or not without blocking the main process, i.e. the monitoring program. Something like this: Considering the fact I have the child pid I have tried the following: , which I think is not a good way to track the status of the child process, given that it is not safe from race conditions. Moreover it did not work or at least it seemed so. Inspecting with whether exists.
Can't enter the letter 'e' over ssh
My problem is not the same as can't type lower cased e in amazon ec2 (Amazon Linux), but similar. After checking /etc/inputrc and finding nothing out of the ordinary, I remembered that I did do some keybinding in the /etc/bash.bashrc. This was already there for a very long time and worked flawlessly, though. Why would it make problems now?
Does while spawn a subshell in bash?
The reason why your variable value is not kept has already been explained by the other good answer. If you feel like, you can read an interesting article about this topic in I set variables in a loop that's in a pipeline. Why do they disappear after the loop terminates? Or, why can't I pipe data to read?. I just want to show another way to loop through your files, so that you don't parse at all: That's it! Just let expand to provide all the contents in the directory.
Perl /Sed replacement
Below command is used to replace the password in a script but the perl command is adding a white space when it does the subsstitution password=arche20 perl -i -p -e "s/^(password[]*=[ ]*).*$/\1 $passwd/" config.properties cat config.properties userid=ARCHE password= arche20 It does the work but it seems to be adding a space after password when it replaces. Could this be done without the space? Got a sed way: sed -i "s/password.*/password=$passwd/g"
Wildcards for filepaths aren't working in grep
As far as your patterns are concerned, this would be the safest to match only intended strings: grep 'AB.\{0,1\}-DEF' file.txt Or grep -E 'AB.?-DEF' file.txt . matches any single character, ? and \{0,1\} matches the previous token zero or one time, so in total .? and .\{0,1\}will match zero or one character before -DEF. If you use AB.*-DEF or AB.*DEF, grep will greedily match unintended strings, for example: ABCG-DEF ABCGLHHJKH90-DEF
Does bash open files in O_APPEND when using ">>" on linux?
If we use then Documentation says that the output is appended. My guess is that, if some-file does not exist, then O_CREAT will make a new file. If was used, then O_TRUNC will truncate existing file. In case of : Will the file be opened as O_WRONLY (or O_RDWR) and seeked to end and write operation is done , simulating O_APPEND ? Or will the file be opened as O_APPEND , leaving it to the kernel to make sure appending happens ?
How to use [\w]+ in regular expression in sed?
Different tools and versions thereof support different variants of regular expressions. The documentation of each will tell you what they support. Standards exist so that one can rely on a minimum set of features that are available across all conforming applications.
bash - why does \x0d\x20 erase the line
Characters of code 0 to 31 in ASCII are control characters. When sent to a terminal, they're used to do special things. For instance, (BEL, 0x7) rings the terminal's bell. (BS, 0x8) moves the cursor backward. (LF, 0xa) moves the cursor one row down, (TAB 0x9) moves the cursor to the next tabulation... (CR, 0xd) moves the cursor to the first column.
why isn't df output default to a human readable format?
It is more precise to output the byte count rather than the human readable numbers. I use both, but when copying data or verifying file sizes, non-human readable is a must. Since one person's sensible default is another's constant annoyance, there's really no 'right' or 'wrong' answer. However, it is easy to force df to output human readable numbers: $ echo "alias df='df -h'" >> ~/.bashrc If you ever want to use df in its default mode, escape it with a \ like this: $ \df
Echo command with AND operator doesn't exit
Your confusion stems from the fact that in many popular languages, especially C-based ones, sequences are stopped being evaluated when 0 is encountered because only 0 is considered and everything else is . In Bash, however, it's not the case. By convention, in POSIX systems return code 0 is considered (there was no error, so nothing is returned) and a non-zero return code is considered .
How to filter some files out of my directory?
I have some files in my directory. They can be classified into two categories: the files' name pattern in class one are like that have five numbers separated by four dash; the files' name pattern in class two are like that are also separated by dash but have letters before or after or both of before and after these numbers. My question is that how to filter these files in class one out of my directory by moving them into a directory named by .
Which linux package contains the top command?
You can do to see what package provides a file. For example, will tell you for top or if you weren't sure of the path.
Newest 'magic-the-gathering' Questions
Magic: The Gathering is a collectible card game for 2 or more players, set in a variety of fantastical realms. Players take on the role of a powerful wizard and duel in a battle of wits, using cards that represent resources such as creatures, objects, spells and enchantments. 4,858 questions Filter by Sorted by Tagged with 1 vote 0 answers 19 views Does Equinox take replacement effects into account? Suppose I control Umbra Mystic and a land that's also an Aura.
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with Eric
Contact Eric, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack