Sponsored Content
Top Forums Shell Programming and Scripting Redirect output of print statement to file Post 302348188 by vidyadhar85 on Thursday 27th of August 2009 03:23:45 PM
Old 08-27-2009
Code:
DUP_FILE=`touch /export/.../.../dup_social_$1`

this won't work....
and there is no need to touch a file use redirection operator directly it will create the file itself
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

redirect output to file?

Hi: I am currently working on a program which requires direct its ouput to a file here is an example ./proram arg_1 arg_2 when program ends all output will be arg_2 file Is that possible I am not a bad programmer, However I am stuck there. Can anyone give a hint? Thanks SW (1 Reply)
Discussion started by: slackware
1 Replies

2. UNIX for Dummies Questions & Answers

How to redirect debug statement to file?

Hi, I need to redirect the debug statements to out.txt {(set -x) >> out.txt} ??? (1 Reply)
Discussion started by: redlotus72
1 Replies

3. UNIX for Dummies Questions & Answers

Redirect output to a file

Ahhhrrrggg I'm having a brain fart... I want to take the output of a command and redirect it to a file... This works.... $ man cp | cat >> copy_help but this doesn't keytool -help |cat >> keytool_help It just produces... these lines... more keytool_help ] ... ... (11 Replies)
Discussion started by: jimmyc
11 Replies

4. UNIX for Dummies Questions & Answers

redirect output to a file name

Hi all!! is possible to assign the output of some command to filename, i.e. grep_output.txt Otherwise, I want to open a new file which name is inside another, how can I do it? Thanks a lot! (7 Replies)
Discussion started by: csecnarf
7 Replies

5. Shell Programming and Scripting

Redirect the output to a .xls file

Hi, I am using the sybase database server though unix platform and try to retrieve some data by the help of select statement, and my main issue is i want to redirect all the the data i.e. retrieve from the select statement to a .xls file with the same column name and the outputs. How can i do... (5 Replies)
Discussion started by: anupdas
5 Replies

6. Shell Programming and Scripting

How redirect standard output to a file

Hi guys, i have a script named purgeErrors.ksh, when i execute this script i need to redirect the output to a log file in the same directory, how can i do that ?? -- Aditya (5 Replies)
Discussion started by: chaditya
5 Replies

7. Shell Programming and Scripting

How to redirect output of ls to a file?

Hi All, I want to redirect only the file names to a new file from the ls -ltr directroy. how Can i do it. my ls -ltr output will be as below. -rwxr-xr-x 1 118 103 28295 Jul 26 2006 event.podl -rwxr-xr-x 1 118 103 28295 Jul 26 2006 xyz.podl I want my new file... (6 Replies)
Discussion started by: girish.raos
6 Replies

8. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

9. Shell Programming and Scripting

Redirect script output to a file and mail the output

Hi Guys, I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts. I used below but it is not working: OFILE=/home/home1/report1 echo "report1 details" > $OFILE =/home/home1/1.sh > $OFILE echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies

10. Shell Programming and Scripting

Redirect the output of the telnet to a file

Hi, I am using cygwin. Below is my script that reads all ip ports for iplist.txt and telnets to it. ( file="iplist.txt" while read line do echo $line echo $(telnet $line) done <"$file" ) > output2.txt ~ while the output2.txt gets the first echo but does not show the second... (2 Replies)
Discussion started by: mohtashims
2 Replies
touch(1)							   User Commands							  touch(1)

NAME
touch, settime - change file access and modification times SYNOPSIS
touch [-acm] [-r ref_file | -t time] file... touch [-acm] [date_time] file... settime [-f ref_file] [date_time] file... DESCRIPTION
The touch utility sets the access and modification times of each file. The file operand is created if it does not already exist. The time used can be specified by -t time, by the corresponding time fields of the file referenced by -r ref_file, or by the date_time op- erand. If none of these are specified, touch uses the current time (the value returned by the time(2) function). If neither the -a nor -m options are specified, touch updates both the modification and access times. A user with write access to a file, but who is not the owner of the file or a super-user, can change the modification and access times of that file only to the current time. Attempts to set a specific time with touch will result in an error. The settime utility is equivalent to touch -c [date_time] file. OPTIONS
The following options are supported in the touch and settime utilities: touch The following options are supported for the touch utility: -a Changes the access time of file. Does not change the modification time unless -m is also specified. -c Does not create a specified file if it does not exist. Does not write any diagnostic messages concerning this condition. -m Changes the modification time of file. Does not change the access time unless -a is also specified. -r ref_file Uses the corresponding times of the file named by ref_file instead of the current time. -t time Uses the specified time instead of the current time. time will be a decimal number of the form: [[CC]YY]MMDDhhmm[.SS] where each two digits represent the following: MM The month of the year [01-12]. DD The day of the month [01-31]. hh The hour of the day [00-23]. mm The minute of the hour [00-59]. CC The first two digits of the year. YY The second two digits of the year. SS The second of the minute [00-61]. Both CC and YY are optional. If neither is given, the current year will be assumed. If YY is specified, but CC is not, CC will be derived as follows: +-----------------------------------------------------------+ | If YY is: CC becomes: | +-----------------------------------------------------------+ |69-99 19 | |00-38 20 | |39-68 ERROR | +-----------------------------------------------------------+ The resulting time will be affected by the value of the TZ environment variable. If the resulting time value precedes the Epoch, touch will exit immediately with an error status. The range of valid times is the Epoch to January 18, 2038. The range for SS is [00-61] rather than [00-59] because of leap seconds. If SS is 60 or 61, and the resulting time, as affected by the TZ environment variable, does not refer to a leap second, the resulting time will be one or two seconds after a time where SS is 59. If SS is not given, it is assumed to be 0. settime The following option is supported for the settime utility: -f ref_file Uses the corresponding times of the file named by ref_file instead of the current time. OPERANDS
The following operands are supported for the touch and settime utilities: file A path name of a file whose times are to be modified. date_time Uses the specified date_time instead of the current time. This operand is a decimal number of the form: MMDDhhmm[YY] where each two digits represent the following: MM The month of the year [01-12]. DD The day of the month [01-31]. hh The hour of the day [00-23]. mm The minute of the hour [00-59]. YY The second two digits of the year. YY is optional. If it is omitted, the current year will be assumed. If YY is specified, the year will be derived as follows: +-----------------------------------------------------------+ | YY Corresponding Year | |69-99 1969-1999 | |00-38 2000-2038 | |39-68 ERROR | +-----------------------------------------------------------+ If no -r option is specified, no -t option is specified, at least two operands are specified, and the first operand is an eight- or ten-digit decimal integer, the first operand will be assumed to be a date_time operand. Otherwise, the first operand will be assumed to be a file operand. USAGE
See largefile(5) for the description of the behavior of touch when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes). When existing file access and modification times cannot be determined (which will occur if a call to stat(2) fails), both times can be changed to known values by settime and utime(2). However, in this case, touch -a (without -m) and touch -m (without -a) will fail because the unchanged time cannot be preserved. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of touch: LANG, LC_ALL, LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH. TZ Determine the timezone to be used for interpreting the time option-argument or the date_time operand. EXIT STATUS
The following exit values are returned: 0 The touch utility executed successfully and all requested changes were made. >0 An error occurred. The touch utility returned the number of files for which the times could not be successfully modified. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |Standard |See standards(5). | +-----------------------------+-----------------------------+ SEE ALSO
stat(2), time(2), utime(2), attributes(5), environ(5), largefile(5), standards(5) NOTES
Users familiar with the BSD environment will find that for the touch utility, the -f option is accepted but ignored. The -f option is unnecessary because touch will succeed for all files owned by the user regardless of the permissions on the files. SunOS 5.11 9 Sep 2008 touch(1)
All times are GMT -4. The time now is 07:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy