10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need to divide the number of white spaces by total number of characters in a file using bash. I am able to get the number of white spaces correctly using:
tr -cd < afile | wc -c
I am also able to get the total number of characters using:
wc -c afile
How do I divide the first... (2 Replies)
Discussion started by: ngabrani
2 Replies
2. Programming
When i want to use a list of strings
char *list; i never understand it well.
Here is an easy example. It took me long to figure it out, searching the web didn't help much:
#include <stdio.h>
int main(void)
{
char *list = {"foo", "bar", "baz"};
char **pl;
int... (6 Replies)
Discussion started by: tornow
6 Replies
3. Shell Programming and Scripting
Hello,
Could someone explain how this one is possible:
# @ x = 10 - 11 + 3
# echo $x
-4
I know that writing script using csh is bad idea, but I need to write few lines.
thanks
Vilius (2 Replies)
Discussion started by: vilius
2 Replies
4. UNIX for Dummies Questions & Answers
Hello all,
I'd like to know how to perform arithmetic on multiple files. I have got many tab-delimited files. Each file contains about 2000 rows and 2000 columns.
What I want to do is to to sum the values in each row & column in every file.
The following explains what I want to do;
... (9 Replies)
Discussion started by: Muhammad Rahiz
9 Replies
5. Programming
I have been getting some flack recently for my use of strlen() and strnlen(). Honestly I have always just taken their functionality for granted as being the easiest way of getting the length of a string. Is it really so much better to do pointer arithmetic? What am I gaining besides more... (3 Replies)
Discussion started by: jjinno
3 Replies
6. Programming
If one wants to get a start address of a array or a string or a block of memory via a function, there are at least two methods to achieve it:
(1) one is to pass a pointer-to-pointer parameter, like:
int my_malloc(int size, char **pmem)
{
*pmem=(char *)malloc(size);
if(*pmem==NULL)... (11 Replies)
Discussion started by: aaronwong
11 Replies
7. UNIX for Dummies Questions & Answers
Hello,
I have a list of 'inputs' and i want to convert those on the second list named 'Desired Outputs', but i don't know how to do it?
Inputs Desired Outputs
1 2
94 4
276 8
369 10
464 12 ... (0 Replies)
Discussion started by: filda
0 Replies
8. Shell Programming and Scripting
Yes I know tcsh sucks for scripting and arithmetic but I have to write a script for multiple users and they all use tcsh.
I have this variable that I 'set' with but pulling numbers off of stings with
set STUFF = `grep string file | awk command`
Now I would like to add up the numbers that... (4 Replies)
Discussion started by: gobi
4 Replies
9. Shell Programming and Scripting
Folks,
I am wondering that i can use something like this in one line.
For example, $((cat filename > wc -l) / 2)
It doesn't work; how to get it work using command substitution?
Moreover, is there any option for wc -l not to return filename after the line counts?
wc -l filename would... (3 Replies)
Discussion started by: lalelle
3 Replies
10. Shell Programming and Scripting
Helloo..
I am trying one very simple thing I could not find anything on google..
I have 2 integer variable..and I need to do division...in ksh
where $catch and $num are integer variable..
I tryed with this:
printf "%0.2f" $final=$catch/$num
but it does not work..
any help is... (12 Replies)
Discussion started by: amon
12 Replies