12-21-2001
Use a variable to store the line and initialize to the date. Include some trailing spaces. Like this:
xspline="${year}${month}${day} "
Next inside your loop, each time that you have a new value for xsp, add it to the line. Include some leading spaces. Like this:
xspline="${xspline} ${xsp}"
Finally, print it out:
echo "${xspline}"
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a 1 million record file and in there i have 580 bad records meaning like they were spread on to 2 lines and is making my process fail as it is expecting single line records. How can i correct this records spread into 2 lines into single line or how i can writer these records into a new... (34 Replies)
Discussion started by: dsravan
34 Replies
2. UNIX for Dummies Questions & Answers
Dear Ones,
kindly help me to create a data file from the report file as shown here under( i am new one to unix KNOW BASIC COMMANDS)
file:rama.prt
(ist record)(3 to 4 lines of text with different filed names)
Name :M.LALITHA DOB:12/11/45 DESG :JA(P)
STANO:300175 ... (3 Replies)
Discussion started by: cvvsnm
3 Replies
3. Shell Programming and Scripting
Hi All
I am reading data from the database and writing to temporary file in the below format.
1=XP|external_component|com.adp.meetingalertemail.processing.MeetingAlertEmail|EMAILALERTPUSH|32|4#XP |classpath|/usr/home/dfusr/lib/xalan.jar:
/usr/home/dfusr/lib/xerces.jar: ... (2 Replies)
Discussion started by: rajeshorpu
2 Replies
4. Shell Programming and Scripting
I've never written scripts (just switched from Ada to C++). I have a book that's over my head and a few examples, other then that I'm floundering. Everything here at work is being done in C Shell. None of the C++ programmers are experienced in shell scripting.
I have a data file with the... (2 Replies)
Discussion started by: bassmaster
2 Replies
5. Shell Programming and Scripting
Below is the data content of file_1 and file_2:
file_1
>sample_1
FKGJGPOPOPOQA
ASDADWEEWERE
ASDAWEWQWRW
ASDASDASDASDD
file_2
>sample_1
DRTOWPFPOPOQA
ASDADWEEASDF
ASDADRTYWRW
ASDASDASDASDD
I got try the following perl script. Unfortunately, it can't give my desired output result... (7 Replies)
Discussion started by: patrick87
7 Replies
6. Shell Programming and Scripting
Input file
>Read_1
XXXXXXXXXXSDFXXXXXDS (condition 1: After the last "X" per line, if the distance is less than or equal to 3 letter, replace those not "X" letter with "X")
TREXXXXXXXSDFXXXXXDS (condition 2: Before the first "X" per line, if the distance is less than or equal to 3 letter,... (12 Replies)
Discussion started by: patrick87
12 Replies
7. Shell Programming and Scripting
I got three different file:
Part of File 1
ARTPHDFGAA
.
.
Part of File 2
ARTGHHYESA
.
.
Part of File 3
ARTPOLYWEA
.
. (4 Replies)
Discussion started by: patrick87
4 Replies
8. Shell Programming and Scripting
Hi,
I am an amateur bash scriptwriter and I need to write a script which creates a report in a formatted, easy to read table-like that is displayed to standard output. The script has to export the followings: Process ID,User Name, Command Name,Priority.....
Now I have a file that I can see all... (3 Replies)
Discussion started by: bashily
3 Replies
9. Shell Programming and Scripting
Data
I was trying to write shell script which will be return the output in the below format
First i was trying to do these using sed.
sed -n '/.ksh/p' mainksh.ksh
sed -e 's/*\(.*\)/\1/g' mainksh.ksh
$RUN_DIR, $SUB_DIR and the variables which will be defined in the profile file.
when i am... (0 Replies)
Discussion started by: rameshds
0 Replies
10. Shell Programming and Scripting
I have a log file that looks like this. the lines are grouped. 2 lines per entry.
M: 2019-01-25 13:02:31.698 P25, received network transmission from KI4EKI to TG 10282
M: 2019-01-25 13:02:35.694 P25, network end of transmission, 4.3 seconds, 1% packet loss
M: 2019-01-25 13:02:38.893 P25,... (7 Replies)
Discussion started by: ae4ml
7 Replies
LEARN ABOUT OPENSOLARIS
timeout
timeout(9F) Kernel Functions for Drivers timeout(9F)
NAME
timeout - execute a function after a specified length of time
SYNOPSIS
#include <sys/types.h>
#include <sys/conf.h>
timeout_id_t timeout(void (* func)(void *), void *arg,
clock_t ticks);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
func Kernel function to invoke when the time increment expires.
arg Argument to the function.
ticks Number of clock ticks to wait before the function is called. Use drv_usectohz(9F) to convert microseconds to clock ticks.
DESCRIPTION
The timeout() function schedules the specified function to be called after a specified time interval. The exact time interval over which
the timeout takes effect cannot be guaranteed, but the value given is a close approximation.
The function called by timeout() must adhere to the same restrictions as a driver soft interrupt handler.
The delay(9F) function calls timeout(). Because timeout() is subject to priority inversion, drivers waiting on behalf of processes with
real-time constraints should use cv_timedwait(9F) rather than delay().
RETURN VALUES
The timeout() function returns an opaque non-zero timeout identifier that can be passed to untimeout(9F) to cancel the request.
CONTEXT
The timeout() function can be called from user, interrupt, or kernel context.
EXAMPLES
Example 1 Using timeout()
In the following example, the device driver has issued an IO request and is waiting for the device to respond. If the device does not
respond within 5 seconds, the device driver will print out an error message to the console.
static void
xxtimeout_handler(void *arg)
{
struct xxstate *xsp = (struct xxstate *)arg;
mutex_enter(&xsp->lock);
cv_signal(&xsp->cv);
xsp->flags |= TIMED_OUT;
mutex_exit(&xsp->lock);
xsp->timeout_id = 0;
}
static uint_t
xxintr(caddr_t arg)
{
struct xxstate *xsp = (struct xxstate *)arg;
.
.
.
mutex_enter(&xsp->lock);
/* Service interrupt */
cv_signal(&xsp->cv);
mutex_exit(&xsp->lock);
if (xsp->timeout_id != 0) {
(void) untimeout(xsp->timeout_id);
xsp->timeout_id = 0;
}
return(DDI_INTR_CLAIMED);
}
static void
xxcheckcond(struct xxstate *xsp)
{
.
.
.
xsp->timeout_id = timeout(xxtimeout_handler,
xsp, (5 * drv_usectohz(1000000)));
mutex_enter(&xsp->lock);
while (/* Waiting for interrupt or timeout*/)
cv_wait(&xsp->cv, &xsp->lock);
if (xsp->flags & TIMED_OUT)
cmn_err(CE_WARN, "Device not responding");
.
.
.
mutex_exit(&xsp->lock);
.
.
.
}
SEE ALSO
bufcall(9F), cv_timedwait(9F), ddi_in_panic(9F), delay(9F), drv_usectohz(9F), untimeout(9F)
Writing Device Drivers
SunOS 5.11 16 Jan 2006 timeout(9F)