Sponsored Content
Top Forums Shell Programming and Scripting Want to add a word in front a of each line of a file Post 302305146 by apjneeraj on Wednesday 8th of April 2009 05:09:32 AM
Old 04-08-2009
Want to add a word in front a of each line of a file

Hi,

Can anybody help me how to add a word in front of a line in a file.Actually it is bit tricky to add a word. i will give a sample for this:

Input :

1110001 ABC DEF
1110001 EFG HIJ
1110001 KLM NOP
1110002 QRS RST
1110002 UVW XYZ

Output:
%HD% 1110001 ABC DEF
%DT% 1110001 EFG HIJ
%DT% 1110001 KLM NOP
%HD% 1110002 QRS RST
%DT% 1110002 UVW XYZ

you see...i need to add %HD% for a unique number when it encounters in each line and then successvely add %DT% till another unique number encounters.

Please help me to meet this requirement.

Thanks in advance.

Best Regards,
Neeraj
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies

2. Shell Programming and Scripting

Add a word at the end of each line in a file

Hi I want to read a flat file and add a word/value at the end of each line in the file and store the output in a temporary file. How can i do this? Plz help me with this. Regards, Saurabh (6 Replies)
Discussion started by: bhalotias
6 Replies

3. Shell Programming and Scripting

Adding a word in front of a word of each line.

Adding a word in front of a word of each line.In that line only one word will be there. pl help:( (4 Replies)
Discussion started by: Ramesh Vellanki
4 Replies

4. Shell Programming and Scripting

How join line and add | in front

Hello, Did any one know how to use perl join line and add | in front Input--> timestamp=2009-11-10-04.55.20.829347; a; b; c; ddaa; timestamp=2009-11-10-04.55.20.829347; aa; bb; cc; Output--> ... (2 Replies)
Discussion started by: happyday
2 Replies

5. Shell Programming and Scripting

how to add single digit in front of the word and line in the file.

Hi , how to add the single digit to front of the word and front of the lines in the one file with compare pattern file and get digit. like example pattern file pattern.txt pattern num bala 2 raja 3 muthu 4 File Name: chennai.dat muthu is good boy raja is bad boy selvam in super... (6 Replies)
Discussion started by: krbala1985
6 Replies

6. Shell Programming and Scripting

Script for adding a word in front of all line in a file

Hi I've one file full of paths of certain files and I want to add some extra file words in front of all the paths. for eg: i have a file name test.txt which show some details only.. 024_hd/044/0344eng.txt 035_bv/222/editor.jpg here I want to add /usr/people/indiana/ infront of all the... (4 Replies)
Discussion started by: ratheeshp
4 Replies

7. Shell Programming and Scripting

add a word every other line

hey guys, How to add a line to every other line, means adding a line to the above of all the lines of a file? tnx (4 Replies)
Discussion started by: Johanni
4 Replies

8. Shell Programming and Scripting

Fetch entries in front of specific word till next word

Hi all I have following file which I have to edit for research purpose file:///tmp/moz-screenshot.png body, div, table, thead, tbody, tfoot, tr, th, td, p { font-family: "Liberation Sans"; font-size: x-small; } Drug: KRP-104 QD Drug: Placebo Drug: Metformin|Drug:... (15 Replies)
Discussion started by: Priyanka Chopra
15 Replies

9. UNIX for Dummies Questions & Answers

Add word/value at the beginning of each line in a file

how to add value/word at the beginning of each line in a file ? i have file number.txt and the output is below 1000 1001 1002 1003 1004 i want to add 000 at the beginning of each line, desire output is below 0001000 0001001 0001002 0001003 0001004 and so on please advise how... (5 Replies)
Discussion started by: jason6247
5 Replies

10. Shell Programming and Scripting

Read a File line by line and split into array word by word

Hi All, Hope you guys had a wonderful weekend I have a scenario where in which I have to read a file line by line and check for few words before redirecting to a file I have searched the forum but,either those answers dint work (perhaps because of my wrong under standing of how IFS... (6 Replies)
Discussion started by: Kingcobra
6 Replies
scsi_vhci(7D)							      Devices							     scsi_vhci(7D)

NAME
scsi_vhci - SCSI virtual host controller interconnect driver DESCRIPTION
The scsi_vhci driver is a SCSA compliant pseudo nexus driver that supports Solaris operating system I/O multipathing services for SCSI-3 devices. This driver introduces a fundamental restructuring of the Solaris device tree to enable a multipath device to be represented as single device instance rather than as an instance per physical path as in earlier Solaris versions. The multipath SCSI target devices managed by this driver are identified and represented by using SCSI-3 VPD page(0x83) as the device's unit address. Symbolic links in /dev/[r]dsk continue to adhere to the cNtNdNsN format. cN is the logical controller number assigned to this driver instance. tN is the global unique identifier (GUID) of the multipath target device (64/128 bits), represented as hexadecimal numbers. The following is an example of a system with a A5000 storage array: ... /dev/rdsk/c4t200000203709C3F5d0s0 -> ../../devices/scsi_vhci/ ssd@g200000203709c3f5:a,raw ... /dev/rdsk/c4t200000203709C3F5d0s7 -> ../../devices/scsi_vhci/ ssd@g200000203709c3f5:h,ra ... The following is an example of a system with a T300 storage array: ... /dev/rdsk/c1t60020F200000033939C2C2B60008D4AEd0s0 -> ../../devices/ scsi_vhci/ssd@g60020f200000033939a2c2b60008d4ae:a,raw ... /dev/rdsk/c1t60020F200000033939A2C2B60008D4AEd0s7 -> ../../devices/ scsi_vhci/ssd@g60020f200000033939a2c2b60008d4ae:h,raw The scsi_vhci driver receives naming and transport services from one or more physical HBA (host bus adapter) devices. To support multi- pathing, a physical HBA driver must comply with the multipathing services provided by this driver. The scsi_vhci driver supports the standard functions provided by the SCSA interface. Configuration The scsi_vhci driver can be configured by defining properties in the scsi_vhci.conf file. The scsi_vhci driver supports the following property: device-type-scsi-options-list To add a third-party (non-Sun) symmetric storage device to run under scsi_vhci (and thereby take advantage of Solaris I/O multipathing), you add the vendor ID and product ID for the device, as those strings are returned by the SCSI Inquiry command. As shipped, the scsi_vhci.conf file contains, in part: # device-type-scsi-options-list = # "SUN SENA", "symmetric-option"; # symmetric-option=0x1000000; For example,to add a device from a vendor with the ID of "Acme" and a product ID of "MSU", you would add: device-type-scsi-options-list = "Acme MSU", "symmetric-option"; symmetric-option=0x1000000; In addition to "Acme," you also might want to add another entry, for example, a device from "XYZ" vendor with a product ID of "ABC:" device-type-scsi-options-list = "Acme MSU", "symmetric-option", "XYZ ABC", "symmetric-option"; symmetric-option=0x1000000; FILES
/kernel/drv/sparcv9/scsi_vhci 64-bit kernel module (SPARC). /kernel/drv/scsi_vhci 32-bit kernel module (x86). /kernel/drv/scsi_vhci.conf Driver configuration file. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Architecture |PCI-based systems | +-----------------------------+-----------------------------+ |Availability |SUNWckr | +-----------------------------+-----------------------------+ SEE ALSO
eeprom(1M), prtconf(1M), attributes(5), fcp(7D), fctl(7D), fp(7D), ssd(7D), scsi_abort(9F), scsi_ifgetcap(9F), scsi_pkt(9S), scsi_reset(9F), scsi_transport(9F), scsi_inquiry(9S), scsi_extended_sense(9S) Writing Device Drivers Small Computer System Interface-3 (SCSI-3) NOTES
In previous releases, the scsi_vhci.conf file supported the mpxio-disable property, which allowed you to disable Solaris I/O multipathing on a system-wide basis. This property is not present in the current release of the Solaris operating system. Multipathing is always enabled in scsi_vhci. If you want to disable multipathing, use the mechanisms provided by the HBA drivers. See fp(7D). In previous releases, Solaris I/O multipathing was also known as MPxIO and Sun StorEdge Traffic Manager (STMS). SunOS 5.10 2 Dec 2004 scsi_vhci(7D)
All times are GMT -4. The time now is 09:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy