Sponsored Content
Top Forums Shell Programming and Scripting Replace col 23 - 26 with new value, non delimited file Post 302815469 by blt123 on Friday 31st of May 2013 11:02:36 PM
Old 06-01-2013
i'm still working with this - have come across this scenario - thanks! what happens if i have a dollar amount without any dollars like this:
99999999999999930530130530USD .890000 ABCDE B/S- RV ARS B/S-
99999999999999930530130530USD -.890000 ABCDE B/S- RV ARS B/S-
 

10 More Discussions You Might Find Interesting

1. Ubuntu

Match col 1 of File 1 with col 1 File 2 and create a 3rd file

Hello, I have a 1.6 GB file that I would like to modify by matching some ids in col1 with the ids in col 1 of file2.txt and save the results into a 3rd file. For example: File 1 has 1411 rows, I ignore how many columns it has (thousands) File 2 has 311 rows, 1 column Would like to... (7 Replies)
Discussion started by: sogi
7 Replies

2. UNIX for Dummies Questions & Answers

Search and replace string only in a particular column in a delimited file

I have file with multiple columns. Column values for a record may be same. Now i have to replace a column value(this can be same for the other columns) with new value. File.txt A,B,C,D,A,B,C,D,A,B,C,D A,B,C,D,A,B,C,D,A,B,C,D A,B,C,D,A,B,C,D,A,B,C,D A,B,C,D,A,B,C,D,A,B,C,D... (1 Reply)
Discussion started by: ksailesh
1 Replies

3. Shell Programming and Scripting

Run a program-print parameters to output file-replace op file contents with max 4th col

Hi Friends, This is the only solution to my task. So, any help is highly appreciated. I have a file cat input1.bed chr1 100 200 abc chr1 120 300 def chr1 145 226 ghi chr2 567 600 unix Now, I have another file by name input2.bed (This file is a binary file not readable by the... (7 Replies)
Discussion started by: jacobs.smith
7 Replies

4. UNIX for Dummies Questions & Answers

What awk 1-liner will replace value in 1stField of a delimited file with the value of '5' ?

Hi, I am a newbie to awk. Here is my problem. Looking for an awk 1-liner to solve it: My Computing Environment: - Solaris10 - I prefer to use csh or sh shells 1. Lets say my input file is File1.dat (delimter = | ) and looks as follows: (File1.dat) ... (1 Reply)
Discussion started by: andy b
1 Replies

5. Shell Programming and Scripting

Replace ^M and the new line that follows it in a delimited file

Hello, I want to Replace/Remove ^M and the new line that follows it in a delimited file. So far I have tried following and nothing seems to work for me . Tr –d ‘\r\n’ < old.dat > new.dat -removes all the linefeed, not just the ones after a ^M. Sed ‘/^M$/{N; s/.\n//;}’ < old.dat >... (7 Replies)
Discussion started by: bluestarmoon
7 Replies

6. UNIX for Dummies Questions & Answers

Replace period in a tab delimited file to a number

I have a file like this. It is tab delimited. Unfortunately, the missing data was filled in with a period "." (see the leading lines 1-5 columns) I want to substitute the periods for misisng data with an integer "-999". however, I do not want the global replace to change the other periods seen... (7 Replies)
Discussion started by: genehunter
7 Replies

7. Shell Programming and Scripting

Replace field in the delimited file

Hi, I have the requirement similar to the one mentioned in the below thread. https://www.unix.com/unix-for-dummies-questions-and-answers/128155-search-replace-string-only-particular-column-delimited-file.html The only difference is that I need to change the field for row 1,2 and the last... (14 Replies)
Discussion started by: chetanojha
14 Replies

8. Shell Programming and Scripting

Replace a number in the last line of a delimited file.

Hi all, I am fairly new to UNIX and I was wondering if you could provide me with some help! Lets say i have a file as below : Line 1 Line 2 Line 3 ABC|12|4|2 Now the number 4 in bold, this number will represent the number of row there is in the file excluding the header and footer... (10 Replies)
Discussion started by: Stinza
10 Replies

9. UNIX for Beginners Questions & Answers

Replace a column in tab delimited file with column in other tab delimited file,based on match

Hello Everyone.. I want to replace the retail col from FileI with cstp1 col from FileP if the strpno matches in both files FileP.txt ... (2 Replies)
Discussion started by: YogeshG
2 Replies

10. Shell Programming and Scripting

Replace delimiter for a particular column in a pipe delimited file

I have an input file as below Emp1|FirstName|MiddleName|LastName|Address|Pincode|PhoneNumber 1234|FirstName1|MiddleName2|LastName3| Add1 || ADD2|123|000000000 Output : 1234|FirstName1|MiddleName2|LastName3| Add1 ,, ADD2|123|000000000 OR 1234,FirstName1,MiddleName2,LastName3, Add1 ||... (2 Replies)
Discussion started by: styris
2 Replies
tran_init_pkt(9E)						Driver Entry Points						 tran_init_pkt(9E)

NAME
tran_init_pkt, tran_destroy_pkt - SCSI HBA packet preparation and deallocation SYNOPSIS
#include <sys/scsi/scsi.h> struct scsi_pkt *prefixtran_init_pkt(structscsi_address *ap, struct scsi_pkt *pkt, struct buf *bp, int cmdlen, int statuslen, int tgtlen, int flags, int (*callback, caddr_t),caddr_t arg); void prefixtran_destroy_pkt(struct scsi_address *ap, struct scsi_pkt *pkt); INTERFACE LEVEL
Solaris architecture specific (Solaris DDI). PARAMETERS
ap Pointer to a scsi_address(9S) structure. pkt Pointer to a scsi_pkt(9S) structure allocated in an earlier call, or NULL. bp Pointer to a buf(9S) structure if DMA resources are to be allocated for the pkt, or NULL. cmdlen The required length for the SCSI command descriptor block (CDB) in bytes. statuslen The required length for the SCSI status completion block (SCB) in bytes. tgtlen The length of the packet private area within the scsi_pkt to be allocated on behalf of the SCSI target driver. flags Flags for creating the packet. callback Pointer to either NULL_FUNC or SLEEP_FUNC. arg Always NULL. DESCRIPTION
The tran_init_pkt() and tran_destroy_pkt() vectors in the scsi_hba_tran structure must be initialized during the HBA driver's attach(9E) to point to HBA entry points to be called when a target driver calls scsi_init_pkt(9F) and scsi_destroy_pkt(9F). tran_init_pkt() tran_init_pkt() is the entry point into the HBA which is used to allocate and initialize a scsi_pkt structure on behalf of a SCSI target driver. If pkt is NULL, the HBA driver must use scsi_hba_pkt_alloc(9F) to allocate a new scsi_pkt structure. If bp is non-NULL, the HBA driver must allocate appropriate DMA resources for the pkt, for example, throughddi_dma_buf_setup(9F) or ddi_dma_buf_bind_handle(9F). If the PKT_CONSISTENT bit is set in flags, the buffer was allocated by scsi_alloc_consistent_buf(9F). For packets marked with PKT_CONSIS- TENT, the HBA driver must synchronize any cached data transfers before calling the target driver's command completion callback. If the PKT_DMA_PARTIAL bit is set in flags, the HBA driver should set up partial data transfers, such as setting the DDI_DMA_PARTIAL bit in the flags argument if interfaces such as ddi_dma_buf_setup(9F) or ddi_dma_buf_bind_handle(9F) are used. If only partial DMA resources are available, tran_init_pkt() must return in the pkt_resid field of pkt the number of bytes of DMA resources not allocated. If both pkt and bp are non-NULL, if the PKT_DMA_PARTIAL bit is set in flags, and if DMA resources have already been allocated for the pkt with a previous call to tran_init_pkt() that returned a non-zero pkt_resid field, this request is to move the DMA resources for the subsequent piece of the transfer. The contents of scsi_address(9S) pointed to by ap are copied into the pkt_address field of the scsi_pkt(9S) by scsi_hba_pkt_alloc(9F). tgtlen is the length of the packet private area in the scsi_pkt structure to be allocated on behalf of the SCSI target driver. statuslen is the required length for the SCSI status completion block. If the requested status length is greater than or equal to sizeof(struct scsi_arq_status) and the auto_rqsense capability has been set, automatic request sense (ARS) is enabled for this packet. If the status length is less than sizeof(struct scsi_arq_status), automatic request sense must be disabled for this pkt. If the HBA driver is not capable of disabling ARQ on a per-packet basis and tran_init_pkt() is called with a statuslen that is less than sizeof(struct scsi_arq_status), the driver's tran_init_pkt routine should allocate at least sizeof(struct scsi_arq_status). If an ARS is needed, upon successful ARS done by the HBA driver, the driver must copy the sense data over and set STAT_ARQ_DONE in pkt_state. cmdlen is the required length for the SCSI command descriptor block. Note: tgtlen, statuslen, and cmdlen are used only when the HBA driver allocates the scsi_pkt(9S), in other words, when pkt is NULL. callback indicates what the allocator routines should do when resources are not available: NULL_FUNC Do not wait for resources. Return a NULL pointer. SLEEP_FUNC Wait indefinitely for resources. tran_destroy_pkt() tran_destroy_pkt() is the entry point into the HBA that must free all of the resources that were allocated to the scsi_pkt(9S) structure during tran_init_pkt(). RETURN VALUES
tran_init_pkt() must return a pointer to a scsi_pkt(9S) structure on success, or NULL on failure. If pkt is NULL on entry, and tran_init_pkt() allocated a packet throughscsi_hba_pkt_alloc(9F) but was unable to allocate DMA resources, tran_init_pkt() must free the packet through scsi_hba_pkt_free(9F) before returning NULL. SEE ALSO
attach(9E), tran_sync_pkt(9E), biodone(9F), bioerror(9F), ddi_dma_buf_bind_handle(9F), ddi_dma_buf_setup(9F), scsi_alloc_consis- tent_buf(9F), scsi_destroy_pkt(9F), scsi_hba_attach(9F), scsi_hba_pkt_alloc(9F), scsi_hba_pkt_free(9F), scsi_init_pkt(9F), buf(9S), scsi_address(9S), scsi_hba_tran(9S), scsi_pkt(9S) Writing Device Drivers NOTES
If a DMA allocation request fails with DDI_DMA_NOMAPPING, indicate the error by calling bioerror(9F) with bp and an error code of EFAULT. If a DMA allocation request fails with DDI_DMA_TOOBIG, indicate the error by calling bioerror(9F) with bp and an error code of EINVAL. SunOS 5.10 21 Feb 2003 tran_init_pkt(9E)
All times are GMT -4. The time now is 04:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy