10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello fellow forum members,
I wrote below piece of code to calculate the date after a given date -
date=$DATE_FINAL
declare -a max_month=(0 31 28 31 30 31 30 31 31 30 31 30 31)
eval $(echo $date|sed 's!\(....\)\(..\)\(..\)!year=\1;month=\2;day=\3!')
(( year4=year%4 ))
(( year100=year%100... (9 Replies)
Discussion started by: ektubbe
9 Replies
2. Homework & Coursework Questions
Hello everybody,
I decided to take a Unix Introduction class and have never had experience with programming. Everything was fine until recently when the Prof. started shell scripting and he wants us to make a small script to add unlimited numbers from arguments and from standard input.
I... (8 Replies)
Discussion started by: Florinel76
8 Replies
3. Shell Programming and Scripting
Hello everybody,
I decided to take a Unix Introduction class and have never had experience with programming. Everything was fine until recently when the Prof. started shell scripting and he wants us to make a small script to add unlimited numbers from arguments and from standard input.
I... (1 Reply)
Discussion started by: Florinel76
1 Replies
4. Programming
I have a fundamental question on C pointer arithmetry..
Suppose i have a c string pointer already pointing to a valid location, Can I just do a
charptr = charptr +1;
to get to the next location, irregardless if my program is 32 or 64 bits?
or should i do it this way:
charptr =... (1 Reply)
Discussion started by: Leion
1 Replies
5. 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
6. UNIX for Dummies Questions & Answers
advance happy new year to all,
i am having a script.The purpose of the scripts is as follows.If the current month is march,june,september or december ,inc_flg should be set to '1' otherwise inc_flg should be set to '2'
month= date +"%m"
if || || ||
; then
inc_flg = 1
else
... (6 Replies)
Discussion started by: rajarp
6 Replies
7. 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
8. Shell Programming and Scripting
hello all,
i am having a variable with a value of 0000010000 and if i add the variable with some no:
suppose
i=0000010000
n=`expr $i + 1`
echo $n
the output i am reciving is 10001 .it deletes all the zeros
but i need result as 0000010001..
please help me...
thanks in... (3 Replies)
Discussion started by: ithirak17
3 Replies
9. UNIX for Dummies Questions & Answers
I am a beginner and I have been searching the web all morning for this answer but can't find it anywhere.
I know that
prtint 1*2
will return
1*2
what if i actually want the problem to be calculated
so i want
print 1*2
to return
2
How is this done? (3 Replies)
Discussion started by: tygun
3 Replies
10. UNIX for Dummies Questions & Answers
okay, I'm a complete beginner, and I keep getting stuck on the syntax here. I want to write a script where I read the current time as minutes and seconds, convert the minutes to seconds, and add the two, then redirect the output to a file. the command takes two arguments, which will also be... (1 Reply)
Discussion started by: paprbagprincess
1 Replies