Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. feherke

    Newbie question

    Hi That is CMD problem, not Awk problem. You need to fix your quoting : [ ] ╭─pair─╮ ╭───────pair────────╮ ▼ ▼ ▼ ▼ awk -F, [highlight palegoldenrod]"{nvar="[/highlight]test[highlight palegoldenrod]"; print $1 nvar $2}"[/highlight] tt.txt In...
  2. feherke

    sed regex not working

    Hi Pretty sure it never worked exactly like that, as there is syntax error due to too many slashes ( / ). Do not let yourself confused by the fact that both the s command and the regular expression address are using slashes as delimiters. They are completely separate things : As they...
  3. feherke

    sed regex not working

    Hi I would use an address to split the regular expression in 2 less complex ones : address command ( in lines matching this ) ( do this ) ╭────────────┴───────────╮ ╭──────────┴────────╮ sed '/^prod:admin:batch:daily:/ s/:server1$/:server2/'...
  4. feherke

    How can I escape $1 and && in a SED command

    Hi $1 needs no escaping as it has no special meaning. ( The placeholder for the 1st captured group is \1. ) & can be escaped by prefixing it with a backslash : \&. So should be : sed -i 's/# UserParameter=/UserParameter=systemd.unit.is-active,systemctl is-active --quiet $1 \&\& echo 1 ||...
  5. feherke

    solved - lowercase between quotes "xxx"

    Hi There you concatenated the 3 field. print then out as separate fields. I mean, put comma ( , ) between them, so they get output with output field separator between them. If you not want to change the separators, set the OFS ( output field separator ) to the same as FS ( field separator )...
  6. feherke

    Need to compare two tables and list the differences

    Hi Instead of union all you will need except. That sounds more like a task for triggers instead. Feherke. feherke.github.io
  7. feherke

    comma function for Indian number system...

    Hi Thinking again, would be simpler and faster with a for loop and substr() : function comma(n , i) { for (i = index(n, ".") ? index(n, ".") - 3 : length(n) - 2; i > 1; i -= 2) { n = substr(n, 0, i - 1) "," substr(n, i) } return n } Feherke. feherke.github.io
  8. feherke

    comma function for Indian number system...

    Hi There is nothing special. Let us rewrite it abit : function comma(n , new_n) { new_n = gensub(/([[:digit:]])([[:digit:]]{3}$|[[:digit:]]{2},)/, "\\1,\\2", 1, n) while (n != new_n) { n = new_n new_n = gensub(/([[:digit:]])([[:digit:]]{3}$|[[:digit:]]{2},)/...
  9. feherke

    comma function for Indian number system...

    Hi For integers this should do it for any size : function comma(n , nn) { while (n != nn = gensub(/([[:digit:]])([[:digit:]]{3}$|[[:digit:]]{2},)/, "\\1,\\2", 1, n)) { n = nn } return n } For fractional part I did not got the rule. Feherke. feherke.github.io
  10. feherke

    file availability getline way

    Hi Maybe my memories are failing, as I can not reproduce it right now, but I have a feeling that also met it with print when writing to file. But I would say on file/pipe input/output operations. Feherke. feherke.github.io
  11. feherke

    file availability getline way

    Hi Dumb thing as according to operator precedence should be fine, but in reality you have to add parentheses : awk 'BEGIN{ month=202303 print getline < ("file"month) <0 ? "Not Available" : "Available" }' Feherke. feherke.github.io
  12. feherke

    What means ($_ =~ m/\ &lt;.*\ &gt;/g) ? (perl)

    Hi Those are 2 different metacharacters : . means any character * means the previous entity 0 or more times You can find them documented in the perlre manual's Metacharacters section. Some examples : 'abc' =~ m/<.*>/   # not matches, presence of < and > is mandatory 'a><bc' =~ m/<.*>/ # not...
  13. feherke

    How to send 2 select from mysql database in email like tables

    Hi First of all, never user input data directly interpolated in SQL statement. That way you make your code vulnerable to SQL injection attacks. The Bobby Tables site explains the problem and the solution in simple terms. Apparently there are user 2 completely different data access solutions...
  14. feherke

    How to send 2 select from mysql database in email like tables

    Hi Hard to understand what are you doing there. In the 1st code how does the $message variable get its value ? In the 2nd code how do the $date, $c_user, $to, etc variables get their values ? Probably would be better to show us the code that is not working so we can tell what the problem is...
  15. feherke

    Perl Beginner - Need Help

    Hi Yes, Perl is good for text processing, however it has a relatively steep learning curve. A standup comedian's words about a girl applies to Perl too : "It's that kind of beauty which needs some accommodation". Tried to write a script for your log file but after awhile I realized the format...
  16. feherke

    Perl Beginner - Need Help

    Hi My relation with Mac was never good, so I may ask the dumbest thing now : is the GNU coreutils package available there ? Because if yes, then it has a right tool for you : csplit csplit --digits=3 PoliceLog.txt '%^[0-9]%' '/^[0-9]/' '{*}' For the first part of the file you attached, the...
  17. feherke

    Perl Beginner - Need Help

    Hi There would be one thing to mention : in Perl there is a function like nowhere else(*), the wantarray. It tells to the function in which it is called whether the one which called it intends to assign its return value to an array or not. In your original code, the value read from file was...
  18. feherke

    Perl Beginner - Need Help

    Hi Because there you split() the filehandle itself, not the file content read from the filehandle. my @configdata = <$configfile>; ( No idea what you tried with the split() there, so I skipped it. Reading from filehandle into array does the line splitting automatically. ) Feherke...
  19. feherke

    POST Content-lLength of ... bytes exceeds the limit of 8388608 bytes in Unknown on line 0

    Hi My previous post was too short and too confusing. Let me try again. When the upload size exceeds post_max_size, a startup error is raised. It can not be stopped by ini_set('display_errors', false) and is too late for your script to stop it with ini_set('display_startup_errors', false). So...
  20. feherke

    POST Content-lLength of ... bytes exceeds the limit of 8388608 bytes in Unknown on line 0

    Hi To avoid abusively consuming the resources by uploading unacceptably huge files, that check is performed before preparing the files for processing by your script. So the error is generated automatically without a chance for the script to interfere. Feherke. feherke.github.io

Part and Inventory Search

Back
Top