10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I need to write a BASH script that takes a 2 character string and removes the second character if it is not a digit e.g.
If the string is numberical value >9 e.g. string1 = '34' then leave string1 = '34'.
However if the string is <10 e.g. string1 = '3X' then remove the second char (which... (7 Replies)
Discussion started by: millsy5
7 Replies
2. Shell Programming and Scripting
Hello,
I have some problem in counting char of word, sum and change. I'm not sure shell script can do this.
Input data:
Sam1 BB BB AA AA BB BB BB
Sam2 BB BB AA AA AB AB AB
Sam3 BB BB BB AA BB BB BB
Sam4 AB AB AB AB AB AB AA
Sam5 BB BB AA AA BB BB -- If I count in column 2, B is 9... (3 Replies)
Discussion started by: awil
3 Replies
3. Shell Programming and Scripting
Hi experts a have a very large file and I need to add two columns: the first one numbering the incidence of records and the another with the total count
The input file:
21 2341 A
21 2341 A
21 2341 A
21 2341 C
21 2341 C
21 2341 C
21 2341 C
21 4567 A
21 4567 A
21 4567 C
... (6 Replies)
Discussion started by: juelillo
6 Replies
4. UNIX for Dummies Questions & Answers
Hi
I am having a 'grep' headache
Here is the contents of my file:
(PBZ,CP,(((ME,PBZ,BtM),ON),((ME,((PBZ,DG),(CW9,PG11))),CW9,TS2,RT1)))
I would like to count out how many times 'PBZ' occurs and then place that number in the line above
3... (8 Replies)
Discussion started by: cavanac2
8 Replies
5. Shell Programming and Scripting
To find out number of "|" symbol is available in file:
Input:
a|b|c|d|z
Ouput:
4
I am using below set of commands,It is working... Anybody have anyother solution using sed / awk.
cnt=`wc -c <1.txt`
cnt1=`tr -d "|" <1.txt >c.dat`
cnt2=`wc -c <c.dat`
outp=`expr $cnt... (19 Replies)
Discussion started by: Jairaj
19 Replies
6. Shell Programming and Scripting
I have a file with contents similar to this.
abcd
1234
4567
7666
jdjdjd
89289
9382
92
jksdj
9823
298
I want to write a shell script which count the number of lines that start with the number (disregard the lines starting with alphabets) (1 Reply)
Discussion started by: grajp002
1 Replies
7. Shell Programming and Scripting
for example:
i hav a string like :
/rmsprd/arch01/rmsprd/rmsprdarch72736.log
how I can extract
my_num=72736?
I know I can
echo "/rmsprd/arch01/rmsprd/rmsprdarch72736.log" | tr "/" " " | awk '{ print $4 }' to get rmsprdarch72736.log (4 Replies)
Discussion started by: netbanker
4 Replies
8. UNIX for Dummies Questions & Answers
Hi ..
I am having file say at 53rd position it will be as 0's or 1's .. How can i count the total number of 1's and 0's in the files at the 53 rd location.
Thanks,
Arun (5 Replies)
Discussion started by: arunkumar_mca
5 Replies
9. Shell Programming and Scripting
I wish to compute the number of dot chars in a string.
Example:
VAR="aaaa.bbbbb.cccc"
I try the shortest command to solve this test.
Thanks in advance for your help.
Regards,
Giovanni (7 Replies)
Discussion started by: gio123bg
7 Replies
10. Shell Programming and Scripting
I havent done shell scripting in quite some time. I want to know how to count the number of characters in a word, specifically a parameter.
Example: myscript hello
I want "myscript" to return the number of charcaters in the parameter "hello".
Any ideas? (9 Replies)
Discussion started by: xadamz23
9 Replies