Sponsored Content
Top Forums Shell Programming and Scripting How to adding the filename into file contents Post 89166 by vino on Friday 11th of November 2005 03:42:31 AM
Old 11-11-2005
This is the new output.

=====2005-11-12=====
2005-11-12 03:33:37 ALARM: BTSSPAN-277-1 30-18013
2005-11-12 12:10:28 ALARM: BTSSPAN-297-2 30-18013
2005-11-12 20:40:05 ALARM: BTSSPAN-297-1 30-18013
2005-11-12 23:55:27 ALARM: BTSSPAN-277-1 30-18013

=====2005-11-13=====
2005-11-13 04:32:42 ALARM: BTSSPAN-193-1 30-18013
2005-11-13 05:40:53 ALARM: BTSSPAN-526-1 30-18013
2005-11-13 09:32:16 ALARM: BTSSPAN-297-2 30-18013
2005-11-13 22:33:07 ALARM: BTSSPAN-297-1 30-18013

This is what seems like the original input.

=====2005-11-12=====
03:33:37 ALARM: BTSSPAN-277-1 30-18013
12:10:28 ALARM: BTSSPAN-297-2 30-18013
20:40:05 ALARM: BTSSPAN-297-1 30-18013
23:55:27 ALARM: BTSSPAN-277-1 30-18013
=====2005-11-13=====
04:32:42 ALARM: BTSSPAN-193-1 30-18013
05:40:53 ALARM: BTSSPAN-526-1 30-18013
09:32:16 ALARM: BTSSPAN-297-2 30-18013
22:33:07 ALARM: BTSSPAN-297-1 30-18013

The only difference in both the above exhibits is the introduction of timestamp. There is no filename in the preferred output you have given.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

adding contents of a variable to a command

hi all, i'm new to shell scripting, so i'm not sure how to work this. Is it possible to read in the contents of a variable and add it to a command? for example: ------------------------ #!/bin/sh set example = -dfr rm ${example} ------------------------ when i run the script, i want... (2 Replies)
Discussion started by: gammarays
2 Replies

2. Shell Programming and Scripting

Adding filename into file content

Dear Experts, Please help to teach me how to add the filename into the file content. Actually the file name are EVENTS-20050912. ***************New output that I want*************** EVENTS-20050912 03:33:37 ALARM: BTSSPAN-277-1 30-18013 EVENTS-20050912 12:10:28 ALARM: BTSSPAN-297-2... (1 Reply)
Discussion started by: missutoomuch
1 Replies

3. UNIX for Dummies Questions & Answers

adding contents of file

for example i have a file which contains data like: 123 222 325 142 can anyone help me write a script that adds them? let's say that "total" is the filename... (4 Replies)
Discussion started by: dakid
4 Replies

4. Shell Programming and Scripting

Grabing Date from filename and adding to the end of each line in the file.

Hi, I have 24 .dat files something like below. The file name starts with “abc” followed by two digit month and two digit year. Is there a way to grab the month and year from each filename and append it to the end of each line. Once this is done I want to combine all the files into file... (1 Reply)
Discussion started by: rkumar28
1 Replies

5. Shell Programming and Scripting

Passing filename as parameter and displaying the file contents

Hi All, Its extremely urgent regarding the following requirement. I have created few files in a directory. I have write a program in shell scripting such that it prompts for the filename . once the filename is entered,it should print the contents of the file. Can anyone help with... (7 Replies)
Discussion started by: radhi2424
7 Replies

6. Shell Programming and Scripting

Help with adding leading zeros to a filename

Hi i need help in adding leading zero to filenames e.g file name in my folder are 1_234sd.txt 23_234sd.txt the output i need is 001_234sd.txt 023_234sd.txt can i do this shell scripting please help (2 Replies)
Discussion started by: rsmpk
2 Replies

7. Shell Programming and Scripting

Adding filename to each line of the file

Hi, I am a relative new bee in scripting. I need to develop a script such that the code would iterate through each file in a source directory and append every line of the file with '|' and the corresponding file filename. eg INPUT file IF927_1.dat - H|abc... (4 Replies)
Discussion started by: scripting_newbe
4 Replies

8. UNIX for Dummies Questions & Answers

Adding Filename as column using sed

Hi , Can any one please tell me, how can we add the file name as column using sed. right now we are using the below awk command for adding the file name as column but when we are calling this script from datastage it is deleting the file data..very weird raised a support ticket with datastage.... (2 Replies)
Discussion started by: mora
2 Replies

9. Shell Programming and Scripting

Adding filename and line number from multiple files to final file

Hi all, I have 20 files (file001.txt upto file020.txt) and I want to read them from 3rd line upto end of file (line 1002). But in the final file they should appear to start from line 1. I need following kind of output in a single file: Filename Line number 2ndcolumn 4thcolumn I... (14 Replies)
Discussion started by: bioinfo
14 Replies

10. Shell Programming and Scripting

awk to place specific contents filename within text file

I am trying to use awk to place the contens of a filename in $1 and $2 followed by the data in the text file. Basically, put the filename within the text file. There are over 1000 files in the directory and as of now each file is saved with a unique name but it is not within the file. Thank you... (10 Replies)
Discussion started by: cmccabe
10 Replies
ALARM(3P)						     POSIX Programmer's Manual							 ALARM(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
alarm - schedule an alarm signal SYNOPSIS
#include <unistd.h> unsigned alarm(unsigned seconds); DESCRIPTION
The alarm() function shall cause the system to generate a SIGALRM signal for the process after the number of realtime seconds specified by seconds have elapsed. Processor scheduling delays may prevent the process from handling the signal as soon as it is generated. If seconds is 0, a pending alarm request, if any, is canceled. Alarm requests are not stacked; only one SIGALRM generation can be scheduled in this manner. If the SIGALRM signal has not yet been gener- ated, the call shall result in rescheduling the time at which the SIGALRM signal is generated. Interactions between alarm() and any of setitimer(), ualarm(), or usleep() are unspecified. RETURN VALUE
If there is a previous alarm() request with time remaining, alarm() shall return a non-zero value that is the number of seconds until the previous request would have generated a SIGALRM signal. Otherwise, alarm() shall return 0. ERRORS
The alarm() function is always successful, and no return value is reserved to indicate an error. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
The fork() function clears pending alarms in the child process. A new process image created by one of the exec functions inherits the time left to an alarm signal in the old process' image. Application writers should note that the type of the argument seconds and the return value of alarm() is unsigned. That means that a Strictly Conforming POSIX System Interfaces Application cannot pass a value greater than the minimum guaranteed value for {UINT_MAX}, which the ISO C standard sets as 65535, and any application passing a larger value is restricting its portability. A different type was consid- ered, but historical implementations, including those with a 16-bit int type, consistently use either unsigned or int. Application writers should be aware of possible interactions when the same process uses both the alarm() and sleep() functions. RATIONALE
Many historical implementations (including Version 7 and System V) allow an alarm to occur up to a second early. Other implementations allow alarms up to half a second or one clock tick early or do not allow them to occur early at all. The latter is considered most appro- priate, since it gives the most predictable behavior, especially since the signal can always be delayed for an indefinite amount of time due to scheduling. Applications can thus choose the seconds argument as the minimum amount of time they wish to have elapse before the sig- nal. The term "realtime" here and elsewhere ( sleep(), times()) is intended to mean "wall clock" time as common English usage, and has nothing to do with "realtime operating systems". It is in contrast to virtual time, which could be misinterpreted if just time were used. In some implementations, including 4.3 BSD, very large values of the seconds argument are silently rounded down to an implementation- defined maximum value. This maximum is large enough (to the order of several months) that the effect is not noticeable. There were two possible choices for alarm generation in multi-threaded applications: generation for the calling thread or generation for the process. The first option would not have been particularly useful since the alarm state is maintained on a per-process basis and the alarm that is established by the last invocation of alarm() is the only one that would be active. Furthermore, allowing generation of an asynchronous signal for a thread would have introduced an exception to the overall signal model. This requires a compelling reason in order to be justified. FUTURE DIRECTIONS
None. SEE ALSO
alarm, exec(), fork(), getitimer(), pause(), sigaction(), sleep(), ualarm(), usleep(), the Base Definitions volume of IEEE Std 1003.1-2001, <signal.h>, <unistd.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 ALARM(3P)
All times are GMT -4. The time now is 09:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy