Sponsored Content
Top Forums Shell Programming and Scripting Unable to read the first space of a record in while loop Post 302605236 by machomaddy on Wednesday 7th of March 2012 03:31:09 AM
Old 03-07-2012
Unable to read the first space of a record in while loop

I have a loop like
Code:
while read i
do
echo "$i"
.
.
.
done < tms.txt

The tms.txt contians data like
Code:
2008-02-03 00:00:00
<space>00:00:00
.
.
.
2010-02-03 10:54:32

The above while loop reads the second as 00:00:00 instead of <space>00:00:00.Smilie

Can some one suugest me a way in which I can read the first space also.??
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need to space fill a 2060 byte record

Calling all experts: When I ftp from Mainframe to unix server, the ftp message says fixed length 2060, but i lose trailing spaces. I tried a solution i found here, awk ' { printf("%-2060s\n",$0) } ' fname1 > fname2 works for small records but, err msg: string too long, for long records ... (1 Reply)
Discussion started by: JohnMario
1 Replies

2. UNIX for Dummies Questions & Answers

how to read record by record from a file in unix

Hi guys, i have a big file with the following format.This includes header(H),detail(D) and trailer(T) information in the file.My problem is i have to search for the character "6h" at 14 th and 15 th position in all the records .if it is there i have to write all those records into a... (1 Reply)
Discussion started by: raoscb
1 Replies

3. UNIX for Advanced & Expert Users

"while read ..." loop exiting after reading only one record

Greeting, The following script completes after reading only one record from the input file that contains many records. I commented out the "ssh" and get what I expect, an echo of all the records in the input.txt file. Is ssh killing the file handle? On the box "uname -a" gives "SunOS... (2 Replies)
Discussion started by: twk
2 Replies

4. Shell Programming and Scripting

printing space after a record in awk

friends, I am running iostat command in linux. Following is the output iostat -d Linux 2.6.18-128.el5 (btovm725.ind.hp.com) 04/16/2010 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 21.49 5.32 255.61 2871221 138010414 sda1 ... (8 Replies)
Discussion started by: achak01
8 Replies

5. Shell Programming and Scripting

Replace comma by space for specified field in record

Hi, i want to replace comma by space for specified field in record, i mean i want to replace the commas in the 4th field by space. and rest all is same throught the record. the record is 16458,99,001,"RIMOUSKI, QC",418,"N",7,EST,EDT,902 16458,99,002,"CHANDLER,... (5 Replies)
Discussion started by: raghavendra.cse
5 Replies

6. Shell Programming and Scripting

Update file record inside read loop

Hi, I am reading file records inside a while loop, and want to update the record when certain condition is met. How can I update a file while being read? I want to avoid using temporary files, copy, rename, ... while IFS=',' read -r f1 f2 do function(f1,f2) if then <add... (1 Reply)
Discussion started by: ysrini
1 Replies

7. Shell Programming and Scripting

How to remove space from each record in file?

Hi , I want to remove space from each record in one file My file is like BUD, BDL ABC, DDD, ABC ABC, DDD, DDD, KKK The o/p should be BUD,BDL ABC,DDD,ABC ABC,DDD,DDD,KKK Can any one help me regarding this? (9 Replies)
Discussion started by: jagdishrout
9 Replies

8. Shell Programming and Scripting

Unable to read assign values to two variables in while loop

I am trying to read a input file which has two columns separated by space Input file server1 server2 server3 server4 server5 server6 When i execute the below while code it reads line by line and a and b variables are able to successfully fetch the values while read a b do echo "$a" echo... (5 Replies)
Discussion started by: chidori
5 Replies

9. Shell Programming and Scripting

ksh while read loop breaks after one record - AIX

#!/bin/ksh for SRV in imawasp01 \ imawasp02 \ imawasp03 \ imawasp04 \ imawasp05 \ imawasp06 \ imawasp07 \ imawasp08 \ imawasp09 do print "${SRV}" while read PASSLINE do SRVNAME=`echo ${PASSLINE} | awk -F\: '{print $1}'` LASTLOGIN=`ssh ${SRV} lsuser ${SRVNAME} | tr '... (2 Replies)
Discussion started by: port43
2 Replies

10. Shell Programming and Scripting

Unable to read user input inside a loop

Hi, This query is a part of a much more lengthy script. I wish to look for all the files in a folder named "data" which in this case has two files i.e. plan.war and agent.properties. For all the files found under data I wish to ask the user as to where they wish copy the files to. Below,... (14 Replies)
Discussion started by: mohtashims
14 Replies
TMSCP(4)						     Kernel Interfaces Manual							  TMSCP(4)

NAME
tmscp - DEC TMSCP magtape interface SYNOPSIS
/sys/conf/SYSTEM: NTMSCP 1 # TMSCP controllers NTMS 1 # TMSCP drives TMSCP_DEBUG NO # debugging code in in TMSCP drive (EXPENSIVE) /etc/dtab: #Name Unit# Addr Vector Br Handler(s) # Comments tms ? 174500 260 5 tmsintr # tmscp driver tms ? 164334 0 5 tmsintr # alternate major device number(s): raw: 23 block: 12 minor device encoding: bit: |7 | 6 | 5 | 4 | 3 | 2 | 1 | 0| ------------------------------- C C X D D N U U C = Controller # (max of 4 controllers) D = Density N = Norewind on close U = Unit (drive) number (max of 4 drives per controller) DESCRIPTION
Tape controllers compatible with the DEC Tape Mass Storage Control Protocol (TMSCP) architecture such as the TU81 and the TK50 provide a standard tape drive interface as described in mtio(4). The controller communicates with the host through a packet oriented protocol. Con- sult the file <pdp/tmscp.h> for a detailed description of this protocol. FILES
/dev/MAKEDEV script to create special files /dev/MAKEDEV.local script to localize special files The vector specified in /etc/dtab may be given as an explicit value in which case autoconfig(8) will attempt to allocate the specified vec- tor. The vector may also be (if the system is at revision level 100 or higher) given as 0 - in which case autoconfig(8) will request the kernel to allocate the next available vector (beginning at 01000 and proceeding downward) which autoconfig(8) will initialize. Multiple drives on a single controller are supported. Multiple controllers are also supported. Density selection is specified by bits 3 and 4 in the minor device number. A value of 0 requests the lowest density of a drive and a value of 3 the highest density. Values of 1 and 2 are essentially equivalent (because because TMSCP only defines values for three densities) and request the middle density (for tri-density tape drives). DIAGNOSTICS
tms: !drives. Not enough drives were declared when the kernel was built. The NTMS parameter in the kernel config file needs to be increased by at least one. tms%d stepN init failed: sa %x. Step N of the 4 step initialization sequence has failed. tms%d: random intr. An unexpected interrupt was received. This is indicative of some other device using the same interrupt vector as the TMSCP controller. The interrupt is ignored. tms%d Ver %d Mod %d. The version and model number of the controller are displayed when the controller is initialized. This is an informa- tion message and not an error. tms%d: state %d. The controller state is not one of the 4 initialization states or the RUN state. This indicates a serious problem in the driver and possibly the hardware. tms%d: fatal error %x. The controller detected a ``fatal error'' in the status returned to the host. The contents of the status register are displayed. tms%d init fail. The controller failed to initialize. Indicative of a hardware problem. tms%d,%d flush fail. The cache failed to flush during a close operation. Data loss is possible in this case. tms%d,%d: sa %x state %d. A fatal error. The controller will be reset in an attempt to resume operation. tms ioctl. An invalid internal ioctl function call has been made. This is a driver bug. tms%d,%d inv end. An invalid end (completion) code has been detected. A drive has returned 0 as the opcode originally issued. This is a hardware problem. tms%d,%d bad rsp: %x. An unrecognized response has been received. This is a driver bug. tms%d,%d cache lost The cache on the drive has been lost. Data loss is likely. Usually due to a hardware problem. The following error is produced when a TMSCP error log datagram is received: tms%d,%d dgram fmt=%x evt=%x grp=%x flg=%x pos=%D. Earlier versions of the driver consumed a noticeable amount of kernel D-space decoding and pretty printing more detailed information. This has been removed in favor of a shorter message. In the future an error log daemon will be written and the datagrams from the MSCP and TMSCP drivers passed to it for analysis. SEE ALSO
mt(1), tar(1), tp(1), mtio(4), tm(4), ts(4), ut(4), dmesg(8), dtab(5), autoconfig(8) BUGS
If any non-data error is encountered on non-raw tape, it refuses to do anything more until closed. On quad-density tape drives (the Kennedy 9662 for example) the middle density of 3200bpi is not host selectable (it can be manually selected from the drive's front panel) because TMSCP only defines 800, 1600 and 6250bpi. 3rd Berkeley Distribution December 22, 1995 TMSCP(4)
All times are GMT -4. The time now is 01:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy