Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: itkamaraj
Forum: What is on Your Mind? 08-06-2018
1,864
Posted By Neo
TODO: Create a new "LOL" button, so we can...
TODO:

Create a new "LOL" button, so we can laugh at posts like we give thanks ;)
8,410
Posted By Neo
FYI. In the future, I will will be sending...
FYI.

In the future, I will will be sending out a Tweet or two when working on optimizing the site database or other admin tasks which might cause site performance problems.

For example, when...
569
Posted By RudiC
@itkamaraj: You may want to phrase the arithmetic...
@itkamaraj: You may want to phrase the arithmetic expansion like $(( (LENGTH+1)%3 )) to become an integer value, and using the mod function on LENGTH will fold back if APPEND passes 1000...?...
1,944
Posted By RudiC
Interesting effect when applied to Don Cragun's...
Interesting effect when applied to Don Cragun's text example:
awk -vW=30 -vL="Happy New Year" 'BEGIN{for(i=k=1;i>=1;i+=k) {printf("%*.*s\n",(W/2)+i,i*2-1,L);if(i>=W/2)k=-1}}'
H
...
1,944
Posted By Don Cragun
Yes, this is fun. ;) This isn't quite as...
Yes, this is fun. ;)

This isn't quite as compact as Scrutinizer's approach (and calculates each line as it goes instead of memorizing lines), but there are some fun games you can play with this...
2,010
Posted By Don Cragun
That is a good start. The ERE you are using is...
That is a good start. The ERE you are using is matching a decimal point followed by two decimal digits (which as you have found only matches lines with exactly two decimal places) at the end of the...
2,141
Posted By Don Cragun
The above command will work with some versions of...
The above command will work with some versions of sed, but the standards don't say anything about the replacement string in a sed substitute command converting \n to a <newline> character in the...
2,141
Posted By vgersh99
something to start with: awk...
something to start with:

awk '{gsub("[0-9][0-9]*[.]00",RS "&");print}' myFile
2,184
Posted By Don Cragun
Note that I used a Korn shell in post #2 and...
Note that I used a Korn shell in post #2 and itkamaraj used bash in post #3. If you use bash, you will need to strip leading zeros from minutes and seconds values 08 and 09. The Korn shell treats...
657
Posted By bakunin
Sorry, but this code is as unreadable as probably...
Sorry, but this code is as unreadable as probably possible. You might want to start by bringing it into a form a human can actually understand.
...
3,342
Posted By RudiC
Slight modification of itkamaraj's fine proposal...
Slight modification of itkamaraj's fine proposal to yield the full required output:
echo "a=5; /* this is a comment */" | sed "s;.*\(/\*.*\*/\);\1;"
/* this is a comment */
14,808
Posted By RudiC
Try also awk 'FNR == NR {T[$1]; next} {for (t...
Try also
awk 'FNR == NR {T[$1]; next} {for (t in T) sub (t, _)} 1' file2 file1
Hello
//

*
Hungry
Forum: IP Networking 04-04-2015
2,563
Posted By sea
Lan & Global IP
Heyas

Wasnt sure where to post, but thought this is most matching.
Thanks to Neo we can now see our IP and much more on: https://www.unix.com/what-is-on-your-mind-/256156-what-my-ip-address.html
...
12,505
Posted By alister
It is kind and generous of you to share your...
It is kind and generous of you to share your script with the rest of us. Thank you very much.

I have a few observations which may or may not interest you. If they do not, then nevermind me.


...
1,192
Posted By zazzybob
I think it's best to be a little more verbose...
I think it's best to be a little more verbose when specifying commands like this - especially within scripts. A year later when you come back to look at this (especially since you are asking for help...
1,016
Posted By Franklin52
The use of the length function is superfluous in...
The use of the length function is superfluous in this case.
8,640
Posted By Scott
I think you forgot something important for your...
I think you forgot something important for your awk ;)
1,079
Posted By michaelrozar17
If you want to reproduce sed's + character to *...
If you want to reproduce sed's + character to * then try as below
sed 's/@[a-z0-9A-Z][a-z0-9A-Z]*\.[a-zA-Z0-9][a-zA-Z0-9]*/REPLACE/g'
10,090
Posted By agama
Ah, very good, thanks. Have a go with this: ...
Ah, very good, thanks.

Have a go with this:

awk '
/property name=/ {
gsub( ".*value=" Q, "" );
gsub( Q ".*", "" );
print;
}
' Q="'" RS="[<>]"

...
1,810
Posted By elixir_sinari
Must have been a typo. The quantifier * is for...
Must have been a typo.
The quantifier * is for matching 0 or more occurrences of the previous character/expression.
2,171
Posted By Don Cragun
The -H option is not in the standards and is not...
The -H option is not in the standards and is not implemented on several UNIX and UNIX-like systems. (I don't think it is available on Solaris 10 systems.)

The -l option not only stops when it...
2,143
Posted By vgersh99
awk -v OFS=, 'NR>4{exit}{gsub("-"," -");print...
awk -v OFS=, 'NR>4{exit}{gsub("-"," -");print $1,$2,$3+0,$4+0}' OFMT='%.2f' input
1,661
Posted By balajesuri
perl -lane 'print join " ", sort {$a <=> $b} @F'...
perl -lane 'print join " ", sort {$a <=> $b} @F' input.txt

@itkamaraj: Numerical sorting :-)
Forum: What is on Your Mind? 05-09-2012
17,972
Posted By jlliagre
@methyl: While spaces are obviously not, hyphens...
@methyl: While spaces are obviously not, hyphens are recommended by the Unix standard except as first character.

@guest115:

Unix kernels do not make any limitations in filenames outside two...
1,863
Posted By Scrutinizer
@itka, what if there is a file with "total" in...
@itka, what if there is a file with "total" in the name somewhere? That does not seem hypothetical, whereas the wc "total" line is always the last line...
Showing results 1 to 25 of 44

 

Featured Tech Videos

All times are GMT -4. The time now is 03:59 AM.
Unix & Linux Forums Content Copyright 1993-2021. All Rights Reserved.
Privacy Policy