Sponsored Content
Full Discussion: Formatting a file
Top Forums Shell Programming and Scripting Formatting a file Post 302076903 by cstovall on Friday 16th of June 2006 01:22:02 PM
Old 06-16-2006
Formatting a file

Hi All,

I have been trying to format a file using sed. I can't seem to get the syntax right. I want to append the next line delemited by a comma or a comma and double quotes. Here is an example of the file I'm tring to format:

Before formatting:

00324
03A0312
BRI-u24
0000324
01
H-12
KKG


00325
03A0312
BRI-u25
0000325
02
H-13
KKG


00326
03A0313
BRI-u26
0000326
03
H-14
KKG

After formatting:

00324, 03A0312, BRI-u24, 0000324, 01, H-12, KKG
00325, 03A0312, BRI-u25, 0000325, 02, H-13, KKG
00326, 03A0313, BRI-u26, 0000326, 03, H-14, KKG

or

"00324" , "03A0312" , "BRI-u24" , "0000324" , "01" , "H-12" , "KKG"
"00325" , "03A0312" , "BRI-u25" , "0000325" , "02" , "H-13" , "KKG"
"00326" , "03A0313" , "BRI-u26" , "0000326" , "03" , "H-14" , "KKG"
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with formatting of file.

I have a file with following file format - DMCRH|||83000171|||14022008||0430|||8956612.23|J|||3571235|1378452|23468|6894|9234| DMCRH|||83000215|||15092007||0480|||121.33|J|||LineID003|RefNumSP003|RefNumMem003|0004|0003| What i need done is - 1. Cut the firt four digits of the date (eg 1402... (3 Replies)
Discussion started by: divz
3 Replies

2. UNIX for Dummies Questions & Answers

Formatting a file.

I want to format a file to limit record length = 100, in each line. Any idea how i can do this? (1 Reply)
Discussion started by: abhilasha
1 Replies

3. Shell Programming and Scripting

File Formatting

Hi, Need to delete all the records prior to pattern (INSERT/UPDATE/DELETE). If ' is available, then need to retain it. Input ====================== l_s := ' INSERT INTO TEST' l_P PD := ' UPDATE INTO TEST' l_D := ' DELETE INTO TEST' This is test Input ======================... (1 Reply)
Discussion started by: saurabhbaisakhi
1 Replies

4. Shell Programming and Scripting

File Formatting

Hi, Need to delete all the records prior to pattern (INSERT/UPDATE/DELETE). If ' is available, then need to retain it. Input ====================== l_s := ' INSERT INTO TEST' l_P PD := ' UPDATE INTO TEST' l_D := ' DELETE INTO TEST' This is test Output ======================... (1 Reply)
Discussion started by: saurabhbaisakhi
1 Replies

5. Shell Programming and Scripting

File formatting

I need to count the number of lines between two sets of pattern in a file and delete those lines from that file e.g From jyotiv@yahoo.com test test2 test3 test4 test5 test6 From Jyotiv@yahoo.com So count lines from test to test6 and delete it from the start of file till next From... (1 Reply)
Discussion started by: jyotiv
1 Replies

6. Shell Programming and Scripting

File formatting

Hi, I have a file which contains data in this format # User@Host: abc @ Id: 0000000 # Query_time: 0.000070 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0 SET timestamp=00000000; SELECT @@version, @@version_comment; # User@Host: abcd @ Id: 00000000 # Query_time: 0.000228 ... (6 Replies)
Discussion started by: arijitsaha
6 Replies

7. Shell Programming and Scripting

File Formatting

Hi, I have requirement to format the file.My input file tab(\t) saperated. File format is:- 93 WARNING Sat Mar 17 20:31:59 2012 Sequential_File_0,0: Missing record delimiter "\r\n", saw EOF instead 94 WARNING Sat Mar 17 20:31:59 2012 Sequential_File_0,0: Import... (4 Replies)
Discussion started by: prasson_ibm
4 Replies

8. Shell Programming and Scripting

Need help in formatting a file.

Hi, I have a file in the following format. cat input name: abcd_ef_1 234:343:343 343:234:343 name : abcdef_2 2343:2343:3434: w3243:wr43:2343 2343:2343:23343:3432 2343:34234:2343 name: 3432_343_3 23432:2343 2343:23432:32432 23432:23432:3432432 As you can see... (2 Replies)
Discussion started by: jpkumar10
2 Replies

9. Shell Programming and Scripting

Formatting file data to another file (control character related)

I have to write a program to read data from files and then format into another file. However, I face a strange problem related to control character that I can't understand and solve. The source file is compose of many lines with such format: T_NAME|P_NAME|P_CODE|DOCUMENT_PATH|REG_DATE ... (3 Replies)
Discussion started by: hk6279
3 Replies

10. UNIX for Dummies Questions & Answers

Formatting data in a raw file by using another mapping file

Hi All, i have a requirement where i need to format the input RAW file ( which is CSV) by using another mapping file(also CSV file). basically i am getting feed file with dynamic headers by using mapping file (in that target field is mapped with source filed) i have to convert the raw file into... (6 Replies)
Discussion started by: ravi4informatic
6 Replies
EICONCTRL(8)						    Linux System Administration 					      EICONCTRL(8)

NAME
eiconctrl - configure Eicon active ISDN card SYNOPSIS
eiconctrl [-d Driver-Id] action options ... DESCRIPTION
eiconctrl is used to setup the Eicon ISDN device driver and for downloading the firmware into the ISDN card. The use of eiconctrl makes sense, if you are using an active Eicon ISDN card only. OPTIONS
-d Driver-Id selects the S0/S2M interface named by Driver-Id. Driver-Ids are defined during driver initialisation. See README.eicon for a description of the syntax to be used for modularised and monolithic driver versions. This option must be used to identify the S0/S2M interface if more than one S0/S2M interface is existent. If a single card is used, it may be omitted. If using more than one ISA-Bus-type card, support for the other cards is enabled with the add action of eiconctrl. PCI-Bus-type cards will be automatically added during driver initialisation. Ids may not start with digits or small x, because these values are misinterpreted as numeric parameters by insmod. For loading the module, always the newest modutils package should be used to avoid problems during load. The following actions may be given to eiconctrl. irq [interrupt] sets the irq number to use (only ISA). If the interrupt value is omitted, the current setting will be printed. load protocol [options] Downloads the protocol- and dsp-code into the card and starts operation. protocol etsi Euro-ISDN E-DSS1 (default) 1tr6 German ISDN Protocol .... other protocols are also possible options For options see eiconctrl without any parameters for ISA cards and eiconctrl divaload -h for PCI cards. manage [read|exec <path>] Starts Management-Interface. xlog [cont|<filename>] Retrieving XLOG entries of adapter. With option cont given, it will be on a continuous cycle. Using a driver release 1.77 or newer you can specify a trace-file for the xlog interpreter. isdnlog [on|off] Switch trace-information for isdnlog on/off. CARD SPECIFIC DEFINITIONS
COMMON to all BRI-ISA When using BRI-PtP set -S1 -n -t0 options. Some (very rare) switches require the -S2 here.The offset, set by the on-boards jumpers needs an additional '0' (f.e. Cards jumper setup is 0xd800 - means a membase of 0xd8000 ). S SX SXn SCOM when loading the card's module by insmod / modprobe, you need to specify Membase, IRQ and ID. Only the SCOM is also MCA-supported. S2M When using PRI-PtP set -n -S2 QUADRO Loading this card as usual will automatically find and autoload the remaining three cards. Don't forget to set the Membase, IRQ and ID string using insmod or modprobe. Remember to "eiconctrl load <card_n>" for all "four" cards manually with the desired protocol. When setting the ID's last letter to an "a", the remaining ID's will be continued with "b, c, d" ; Otherwise the ID-string will add a "_2 _3 _4" to the cards device-description. COMMON to all BRI/PRI PCI All cards are auto detected and autoloaded w/o any parameters at insmod/modprobe. Using more than one card in a system will require the eiconctrl "-d" option to load the futher cards. (f.e eiconctrl -d eicon2) You can also use the -all option to get all boards loaded at one time (divaload only). The ETSI protocol is default and is not needed to be set as parm. Otherwise add the desired pro- tocol to specify. The protocolcodes are normally located at /usr/lib/isdn/eicon. 4BRI Loading this card will set the protocol to all "4 cards" same style. You cannot load diffrent codes. This is not a bug! The ID's are set while loading - automatically. PRI When using PRI-PtP set -n -S2 Use option -x to set NT mode. EXAMPLE eiconctrl load etsi loads and starts S0 type adapter with protocol E-DSS1. eiconctrl load etsi -t1 -s1 -n loads and starts S0 type adapter with protocol E-DSS1 PtP. eiconctrl load etsi -s2 -n loads and starts S2M type adapter with protocol E-DSS1. BUGS
No bugs so far but don't hesitate to contact us in case of obvious bug. AUTHOR
(C) 2000 by Armin Schindler <mac@melware.de> SEE ALSO
isdnctrl(8), isdnctrl(4), ttyI(4), isdn_cause(7), isdninfo(4). eiconctrl-V2.3 2000/12/02 EICONCTRL(8)
All times are GMT -4. The time now is 01:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy