<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how to count special characters? in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598637#M104243</link>
    <description>echo 1,2,3,46 | tr -cd '\,' | wc -c</description>
    <pubDate>Mon, 08 Aug 2005 11:22:26 GMT</pubDate>
    <dc:creator>RAC_1</dc:creator>
    <dc:date>2005-08-08T11:22:26Z</dc:date>
    <item>
      <title>how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598635#M104241</link>
      <description>what is the shell command to find the number of the certain character&lt;BR /&gt; &lt;BR /&gt;for example, I have a string&lt;BR /&gt; &lt;BR /&gt;1,2,3,4,6&lt;BR /&gt; &lt;BR /&gt;how do I find the number of "," in the string? &lt;BR /&gt; &lt;BR /&gt;thank you&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Mon, 08 Aug 2005 11:16:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598635#M104241</guid>
      <dc:creator>Gemini_2</dc:creator>
      <dc:date>2005-08-08T11:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598636#M104242</link>
      <description>grep ',' string |wc -c&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Mon, 08 Aug 2005 11:19:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598636#M104242</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2005-08-08T11:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598637#M104243</link>
      <description>echo 1,2,3,46 | tr -cd '\,' | wc -c</description>
      <pubDate>Mon, 08 Aug 2005 11:22:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598637#M104243</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2005-08-08T11:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598638#M104244</link>
      <description>Forget that idea, it didn't work.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Mon, 08 Aug 2005 11:22:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598638#M104244</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2005-08-08T11:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598639#M104245</link>
      <description>If your data is in the file "inputfile", type:&lt;BR /&gt;awk '{FS=",";}{print $NF-2}' &amp;lt; inputfile&lt;BR /&gt;&lt;BR /&gt;If there are no commas, it will issue a "-1 or -2" for that line.&lt;BR /&gt;&lt;BR /&gt;For the line above, it will yield 4&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Aug 2005 11:23:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598639#M104245</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2005-08-08T11:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598640#M104246</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;try &lt;BR /&gt;&lt;BR /&gt;A="a,b,c,d,e,"&lt;BR /&gt;echo $A | awk -v var1="," '{print gsub(var1," ");}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Jean-Luc</description>
      <pubDate>Mon, 08 Aug 2005 11:24:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598640#M104246</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2005-08-08T11:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598641#M104247</link>
      <description>thanks everyone for your speedy reply..&lt;BR /&gt;&lt;BR /&gt;"echo 1,2,3,46 | tr -cd '\,' | wc -c"&lt;BR /&gt;&lt;BR /&gt;is a very interesting use of "tr".&lt;BR /&gt;&lt;BR /&gt;May I ask more questions?&lt;BR /&gt;can you explain more on "tr -cd"&lt;BR /&gt;-c is "first complement SET1", what does it mean?...</description>
      <pubDate>Mon, 08 Aug 2005 11:31:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598641#M104247</guid>
      <dc:creator>Gemini_2</dc:creator>
      <dc:date>2005-08-08T11:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598642#M104248</link>
      <description>The "-c" option tells tr what characters NOT to translate..."-c" (complement) option.&lt;BR /&gt;&lt;BR /&gt;For example the following command makes the non-alphabetic characters in a file stand out by translating them to a number sign.&lt;BR /&gt;&lt;BR /&gt;# tr -c '[A-Z][a-z]' '[#*]' &amp;lt; input_file&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hope it helps!!!&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Aug 2005 12:04:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598642#M104248</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-08-08T12:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598643#M104249</link>
      <description>Pasted below is a C program that you can compile and execute for counting commas (or any character with slight modifications) within your input files.&lt;BR /&gt;&lt;BR /&gt;==============================================================&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#define SPLCHR ','&lt;BR /&gt;&lt;BR /&gt;main()&lt;BR /&gt;{&lt;BR /&gt;   int nc, c;&lt;BR /&gt;&lt;BR /&gt;   while ((c = getchar()) != EOF)&lt;BR /&gt;         if (c == SPLCHR)&lt;BR /&gt;         ++nc;&lt;BR /&gt;   printf("Number of commas in the input string is:  %d\n", nc);&lt;BR /&gt;}&lt;BR /&gt;==============================================================&lt;BR /&gt;&lt;BR /&gt;cheers!&lt;/STDIO.H&gt;</description>
      <pubDate>Mon, 08 Aug 2005 16:22:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598643#M104249</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-08-08T16:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598644#M104250</link>
      <description>Hi,&lt;BR /&gt;echo 1,2,3,4|awk -F, '{print NF-1}'&lt;BR /&gt;&lt;BR /&gt;This counts the number of fields separted by ',' minus 1 giving you the number of the separtor.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Tue, 09 Aug 2005 03:35:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598644#M104250</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2005-08-09T03:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598645#M104251</link>
      <description>*the* command to do so is 'freq' (if you have it). It's one of those lesser used pearls of the ol' unix times&lt;BR /&gt;&lt;BR /&gt;a5:/u/usr/merijn 102 &amp;gt; freq .tcshrc&lt;BR /&gt;|nul       0|       1175|@         6|`        34|&lt;BR /&gt;|soh       0|!         3|A        57|a       116|&lt;BR /&gt;|stx       0|"       104|B         8|b        75|&lt;BR /&gt;|etx       0|#        32|C        39|c       118|&lt;BR /&gt;|eot       0|$       113|D        35|d       102|&lt;BR /&gt;|enq       0|%        42|E        99|e       415|&lt;BR /&gt;|ack       0|&amp;amp;        28|F        13|f        99|&lt;BR /&gt;|bel       2|'        66|G         8|g        25|&lt;BR /&gt;|bs        0|(        58|H        54|h        82|&lt;BR /&gt;|ht      192|)        60|I        37|i       207|&lt;BR /&gt;|lf      253|*         5|J         0|j         4|&lt;BR /&gt;|vt        0|+        11|K         2|k        20|&lt;BR /&gt;|ff        0|,        27|L        45|l       138|&lt;BR /&gt;|cr        0|-        57|M        70|m        66|&lt;BR /&gt;|so        0|.        38|N        47|n       193|&lt;BR /&gt;|si        0|/       199|O        80|o       137|&lt;BR /&gt;|dle       0|0        61|P        72|p       128|&lt;BR /&gt;|dc1       0|1        33|Q         3|q         3|&lt;BR /&gt;|dc2       0|2        21|R        76|r       171|&lt;BR /&gt;|dc3       0|3        19|S        77|s       312|&lt;BR /&gt;|dc4       0|4         6|T        93|t       278|&lt;BR /&gt;|nak       0|5         7|U        28|u        61|&lt;BR /&gt;|syn       0|6        12|V         8|v        79|&lt;BR /&gt;|etb       0|7         1|W         0|w        26|&lt;BR /&gt;|can       0|8        11|X         6|x        17|&lt;BR /&gt;|em        0|9         3|Y        14|y        37|&lt;BR /&gt;|sub       0|:        72|Z         1|z         1|&lt;BR /&gt;|esc       9|;        17|[         9|{        17|&lt;BR /&gt;|fs        0|&amp;lt;         4|\         6||        19|&lt;BR /&gt;|gs        0|=       163|]         8|}        17|&lt;BR /&gt;|rs        0|&amp;gt;         1|^        14|~        10|&lt;BR /&gt;|us        0|?        38|_        25|del       0|&lt;BR /&gt;a5:/u/usr/merijn 103 &amp;gt;&lt;BR /&gt;&lt;BR /&gt;freq also supports -a to show the 8-bit characters&lt;BR /&gt;&lt;BR /&gt;Since many systems don't have it, I have included/attached the source code&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Aug 2005 03:43:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598645#M104251</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-08-09T03:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598646#M104252</link>
      <description>You can try as,&lt;BR /&gt;&lt;BR /&gt;echo 1,2,3,4,6 | perl -ne 's/[^,]//g;print length,"\n";'&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Tue, 09 Aug 2005 03:57:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598646#M104252</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-08-09T03:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598647#M104253</link>
      <description>Hi,&lt;BR /&gt;please, could you assign points?&lt;BR /&gt;&lt;BR /&gt;0 point for this, of course&lt;BR /&gt;&lt;BR /&gt;THX,&lt;BR /&gt;Art</description>
      <pubDate>Tue, 09 Aug 2005 07:15:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598647#M104253</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2005-08-09T07:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to count special characters?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598648#M104254</link>
      <description>After the first person replied me, I assigned the point right away and have not had visiting the forum for a while.&lt;BR /&gt;&lt;BR /&gt;my apology. let me assign some points now.&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Aug 2005 18:18:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-count-special-characters/m-p/3598648#M104254</guid>
      <dc:creator>Gemini_2</dc:creator>
      <dc:date>2005-08-22T18:18:09Z</dc:date>
    </item>
  </channel>
</rss>

