« first day (2664 days earlier)      last day (2291 days later) » 

8:19 AM
@SergiyKolodyazhnyy Hi! Yes, to same degree. It's the language I usually use for some of my private projects.
 
8:36 AM
*some
 
 
3 hours later…
11:20 AM
How your "double" precision math in your very important project degrades to a "bool" in four stages: (1) Use "double" to perform all arithmetics. (2) Display the result with "float" precision. (3) Write the paper and claim "int" percent improvement in [whatever it is]. (4) Tell your family the "bool" result (“Yes, my work is going well”).
3
 
12:20 PM
How can I make awk replace all occurrences of the word in to in fact? in. should change to in fact.. The word separators should remain after the replacement.
 
12:57 PM
@terdon my 100k swag arrived — UL t-shirt, SX mug and a bunch of stickers
 
Take those lines that have ‘apathy’ as the 3rd word in the line, replace it
with the word ‘empathy’ and then print the new lines. Make sure to use grep,
awk AND sed (all 3 must be used).
I can do this using just sed or just awk but I don't know how to use all 3 together :/
 
@StephenKitt Yay! Nice :)
 
and awk... | grep "" | sed "" is not allowed
uni assignments are ridiculous :'(
 
@Yashas why not?
 
@terdon assignment rule :/
 
1:00 PM
Do you need to replace in the original file or print to a new one?
 
new one
 
And you can't use pipes?
I mean, can you use no pipes at all, or is it the specific sequence of awk... | grep "" | sed "" that isn't allowed?
Can you do grep | awk |sed?
 
I can use pipes but I cannot use redundant commands
 
@Yashas Given that any one of those three commands can do it alone, using more than one will be redundant by definition.
Here's a (bash) way to do it without pipes, by the way. It's just kinda moronically complex:
sed 's/apathy/empathy/' <(awk '$3=="apathy"' <(grep apathy file))
 
that won't print the lines where apathy isn't there I think
 
1:06 PM
@Yashas No. Isn't that what you want?
 
I must reprint the entire file with the 3rd field changed to empathy if it was apathy
 
Then what's the point of grep?
grep will delete non-matching lines unless you tell it to match anything.
 
I have absolutely no idea
 
@Yashas This seems to suggest you only want the changed lines, not all of them.
 
@terdon The sample output I was given has all the lines
 
1:08 PM
It says "print the new lines"
 
abc xyz mno
apathy xyz abc
abc xyz apathy
abc apathy apathy apathy
apathy apathy abc apathy
abc xyz mno
apathy xyz abc
abc xyz empathy
abc apathy empathy apathy
apathy apathy abc apathy
that's the sample test case
 
I can't imagine any way of using grep that isn't stupid.
I mean, you could grep . file but what's the point of that?
Or even grep a file, but again.
Are you sure your teacher doesn't just want three commands, one using each of the three tools?
 
but I think that would be considered as redundant command
@terdon then it's impossible using grep?
 
@Yashas It's possible, but only doing something silly.
 
Can grep do replacements?
 
1:13 PM
No
But awk is designed for precisely this sort of thing:
 
then how can the 3rd field be changed to empathy?
 
$ awk '$3=="apathy"{$3="empathy"}1;' file
abc xyz mno
apathy xyz abc
abc xyz empathy
abc apathy empathy apathy
apathy apathy abc apathy
@Yashas Not by grep alone, sorry.
Sed can also easily do it alone:
$ sed -E 's/([a-zA-Z]+ ){2}apathy/\1empathy/' file
abc xyz mno
apathy xyz abc
xyz empathy
apathy empathy apathy
apathy abc empathy
Grep is a "redundant command" by definition here.
Are you sure there was no other rule? Perhaps you should remove blank lines from the file or something?
Hang on, that sed is wrong. This one's correct, you need to count from the beginning of the line:
$ sed -E 's/^([a-zA-Z]+ ){2}apathy/\1empathy/' file
abc xyz mno
apathy xyz abc
xyz empathy
apathy empathy apathy
apathy apathy abc apathy
 
@terdon nothing else has been mentioned
 
@Yashas Do you have more than one file, perhaps?
 
@terdon just one
I am going to complain about this question.
 
1:25 PM
Don't "complain". Just ask for clarification.
 
2:08 PM
How can I replace words using gsub in awk?
The problem I currently have is that I am not able to store the word separator.
 
@Yashas Why gsub? That's the global replacement. And what separator? You just want $3=foo, that will replace te 3rd field with foo.
But all of this would be much better asked as a question on the main site so everyone can benefit.
 
This is for some other question.
 
 
7 hours later…
NH.
9:05 PM
Thinking this question should actually be on this site:
https://serverfault.com/q/893343
(not really anything having to do with Servers...)
 
I'm sure we have dupes for that. It's a common issue.
 
9:35 PM
Hi terdon.
 
9:52 PM
This may end up being a question for the site, but for now it's idle curiosity -- has anyone see GUI apps act like this: replacing certain fonts (?) with square boxes:
this is the second (separate) set of software that's done this recently
 
 
2 hours later…
11:53 PM
Hello?
 

« first day (2664 days earlier)      last day (2291 days later) »