421 reputation
146
bio website
location
age
visits member for 2 years, 3 months
seen Jul 4 at 6:51

the last step of evolution before extinction


Dec
6
comment Using sed get substring between two double quotes
@Jam88: No problem! Don't for get to accept an answer. You can choose your favorite answer by clicking the tick directly to the left of it. Cheers.
Dec
4
comment Using sed get substring between two double quotes
@JonathanLeffler: Good point. Thanks!
Oct
30
comment Store grep output with formatting as it is to a file
@ParthShah: Read this: unix.stackexchange.com/questions/43735/ansi-escape-code-in-vim
Oct
30
comment Store grep output with formatting as it is to a file
@ParthShah: I use vim to do all my editing of files. Unfortunately I have not found a way to let vim easily "pass-through" all the escape codes that make up the formatting. I have however found this script which can parse the escape codes and uses the vim syntax highlighting to recreate the colour codes in the output. According to its description, it should do exactly what you want (but I have not tested it). If you're just looking to view your files you can scroll through them using: less -R newfile.txt
Oct
30
comment Store grep output with formatting as it is to a file
@ParthShah: How are you actually reading/viewing your file? You'll find that the above stores the formatted output exactly how you describe (notice how when you cat your file, it prints the formatted output to your terminal). The program you're using to read/view your file may be altering the file's formatting or cannot simply understand it.
Oct
23
comment Vim-like history in bash?
@naught101: Glad we got it working :-) Yes, using the up/down keys could be problematic (i.e. users may still want the option of history scrollback). You're right the ~/.inputrc file could be modified instead. But some users may not use it. I don't for example.
Oct
23
comment Vim-like history in bash?
@naught101: Did you remember to source your terminal? See step 2. Alternatively, close your terminals and open up a new one. It should then work for you. HTH.
Oct
23
comment Vim-like history in bash?
@naught101: The method I describe accomplishes exactly what you describe. But instead of using the up/down keys, you use alt-p/n. If this is not want you want, you should consider editing your question.
Oct
18
comment Perl command not found
What's the results of: which perl?
Oct
13
comment Filtering output from the “dscl -readall” command
@Ali: I'm not completely sure I understand your first question. The code above will print out a block if it finds the word 'UniqueID' followed by a value greater or equal to 500. This block is a record and will include all the information it contains (this amount of information may change from record to record or it may not: I'm not familiar with dscl output). Regarding the second question; although awk is not ideal for reading xml, it can be used to write it. Please edit your question to include a good amount of sample data and expected output.
Oct
12
comment using sed, how to change the text on line seven to read seventh?
@Steve: Try, sed '7s/.*/seventh/' file.txt
Oct
10
comment Replacing quotes in a file
Yes a good simple solution; why didn't I think of that? You can use time to compare solutions and see what's faster. You may be surprised, sometimes these global substitutions can take a while. But if I were you, I'd probably still accept this answer based on it's simplicity.
Oct
9
comment Replacing quotes in a file
Personally, I like the sed pipe. It's surprisingly easier to read IMO. Both solutions work the same; If the line contains beginning and end quotes, remove them all. And add them back in at print time. Otherwise just remove them all. HTH.
Sep
14
comment linux sort -n uniq -c
@Clustermagnet: You'd want to do sort first, then call uniq. Useless use of cat. Try: < text.txt sort -n | uniq -c
May
23
comment How to get the pid of a running process using a single command that parse the output of ps?
+1 My usual use of pgrep: kill `pgrep xxx`