Sponsored Content
Full Discussion: expr command
Top Forums UNIX for Dummies Questions & Answers expr command Post 4671 by wolf on Monday 30th of July 2001 08:20:20 AM
Old 07-30-2001
Question expr command

I am looking for the correct syntax on the expr command in UNIX. I have a script that I am building at the moment. the script is creating file1 that is an actual .sql file that is going inside the oracle database to get some information in there. It take that information, puts it inside another script called file2. I then do a cat on that file, grep for two lines i need, and put that into two files called file3 and file4, I then do a cut on the values that I need. and put that into files called file5 and file6. Now the values of those files are for example 198.7 and 78.5. With a normal bc command inside the file, it takes away the number that are follwing the desimal sign. expr can do tha, but I do not know how, someone can help me please?

Regards
Wolf
Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problems with expr command

Hi All, I might be making a silly mistake but I need ur help. I have initialized various variables: cur_month=`date +%m` cur_year=`date +%y` last_year=`expr $cur_year \- 1` It works fine for cur_month & cur_year....but has problems with last_year. FOR LAST YEAR IT GIVES A FOLLOWING... (2 Replies)
Discussion started by: rooh
2 Replies

2. Shell Programming and Scripting

about accecing `expr` command

Hi All, I have created 85 users on Linux server. I use bsh shell for all users.But after any user get logged in on unix,he/she is not able to access the expr command.So anyone can tell me that if i have to include some files to access expr command.Because when i write-> expr 6+2 on $ prompt i'll... (1 Reply)
Discussion started by: bhumi
1 Replies

3. UNIX for Dummies Questions & Answers

expr command

hi guys.... i hava a command expr... where i m adding a value in a loop like Tc=`expr $Tc\+ $l` where Tc is declred as a variable and every time l contains a new vaue if Tc =0 initially and l =2 Tc should be equal to 0+ 2 and then l = 4 Tc = 2+4 and dispaly as 6 but after... (5 Replies)
Discussion started by: madhu_aqua14
5 Replies

4. UNIX for Dummies Questions & Answers

problem with expr command

:) hi Unix gurus, Pls consider the following piece of code str='hello' length=echo $str|wc -c echo $length y= ` expr \( 80 - $length \) ` echo $y :confused: The last echo stmt is displaying 0 as the result. If i put direct value like 6 instead of $length in i 3rd stmt it is giving... (8 Replies)
Discussion started by: ravi raj kumar
8 Replies

5. UNIX for Dummies Questions & Answers

using the expr command

Hi friends how can i execute expr $va1 * $var2 provided i m not supposed to use '/' also the nglob variable is turned off. (4 Replies)
Discussion started by: ashishj
4 Replies

6. Shell Programming and Scripting

expr command

Hi Can anyone explain me the usage of this command and the arguments used here and what will be the expected output : v_num=`expr nav_d_20100204_1759 : '*\(*\)'` what will be the value returned in v_num. Thanks in Advance!!! Regards Naveen Purbia (3 Replies)
Discussion started by: trying_myluck
3 Replies

7. Shell Programming and Scripting

help with expr command in script

Hi, I am trying to code a unix function to calculate date difference between two date variables. I am stuck at a point where I am trying to convert hours into minutes. Below is the code I am doing. function get_elapsed_time { export PROPS_FILE=temp.properties export... (8 Replies)
Discussion started by: Nutan
8 Replies

8. UNIX for Dummies Questions & Answers

substring without using expr command

Hi guys, For some reason the terminal on my mac does not let me run string manipulations commands using the expr command. I'm not sure how to fix this so I'm requesting a "work-around" to using the expr command... This is the string I'm working with: "neo_opls01_1.log" And I'm trying to... (9 Replies)
Discussion started by: ah7391
9 Replies

9. Homework & Coursework Questions

expr to translate the date command

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. Write a script called "tod" that will display the time of day in am or pm notation rather then the 24 hour clock time. Use expr to convert from 24-hour clock time. Use... (13 Replies)
Discussion started by: linuxtraining
13 Replies

10. Shell Programming and Scripting

expr command help

I'm trying to check if a variable'd string is only one character and use that in an if statement the only way I could find is: $expr "${var}" : . # expr STRING : regrep where the "." is the grep wildcard for any single character. Whats wrong with my code here and is there a... (3 Replies)
Discussion started by: Tewg
3 Replies
CAT(1)							    BSD General Commands Manual 						    CAT(1)

NAME
cat -- concatenate and print files SYNOPSIS
cat [-beflnstuv] [-] [file ...] DESCRIPTION
The cat utility reads files sequentially, writing them to the standard output. The file operands are processed in command line order. A single dash represents the standard input, and may appear multiple times in the file list. The word ``concatenate'' is just a verbose synonym for ``catenate''. The options are as follows: -b Implies the -n option but doesn't number blank lines. -e Implies the -v option, and displays a dollar sign ('$') at the end of each line as well. -f Only attempt to display regular files. -l Set an exclusive advisory lock on the standard output file descriptor. This lock is set using fcntl(2) with the F_SETLKW command. If the output file is already locked, cat will block until the lock is acquired. -n Number the output lines, starting at 1. -s Squeeze multiple adjacent empty lines, causing the output to be single spaced. -t Implies the -v option, and displays tab characters as '^I' as well. -u The -u option guarantees that the output is unbuffered. -v Displays non-printing characters so they are visible. Control characters print as '^X' for control-X; the delete character (octal 0177) prints as '^?'. Non-ascii characters (with the high bit set) are printed as 'M-' (for meta) followed by the character for the low 7 bits. EXIT STATUS
The cat utility exits 0 on success, and >0 if an error occurs. EXAMPLES
The command: cat file1 will print the contents of file1 to the standard output. The command: cat file1 file2 > file3 will sequentially print the contents of file1 and file2 to the file file3, truncating file3 if it already exists. See the manual page for your shell (i.e., sh(1)) for more information on redirection. The command: cat file1 - file2 - file3 will print the contents of file1, print data it receives from the standard input until it receives an EOF ('^D') character, print the con- tents of file2, read and output contents of the standard input again, then finally output the contents of file3. Note that if the standard input referred to a file, the second dash on the command-line would have no effect, since the entire contents of the file would have already been read and printed by cat when it encountered the first '-' operand. SEE ALSO
head(1), hexdump(1), lpr(1), more(1), pr(1), tail(1), view(1), vis(1), fcntl(2) Rob Pike, "UNIX Style, or cat -v Considered Harmful", USENIX Summer Conference Proceedings, 1983. STANDARDS
The cat utility is expected to conform to the IEEE Std 1003.2-1992 (``POSIX.2'') specification. The flags [-belnstv] are extensions to the specification. HISTORY
A cat utility appeared in Version 1 AT&T UNIX. Dennis Ritchie designed and wrote the first man page. It appears to have been cat(1). BUGS
Because of the shell language mechanism used to perform output redirection, the command ``cat file1 file2 > file1'' will cause the original data in file1 to be destroyed! This is performed by the shell before cat is run. BSD
September 23, 2006 BSD
All times are GMT -4. The time now is 03:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy