Sponsored Content
Top Forums Shell Programming and Scripting Help with formatting of file. Post 302135228 by divz on Friday 7th of September 2007 02:36:59 AM
Old 09-07-2007
Hammer & Screwdriver 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 and 1509)
2. Append it with 01 (140201 and 1509)
3. Append it at the end of the record.

So the record should look like : -
DMCRH|||83000171|||14022008||0430|||8956612.23|J|||3571235|1378452|23468|6894|9234|140201
DMCRH|||83000215|||15092007||0480|||121.33|J|||LineID003|RefNumSP003|RefNumMem003|0004|0003|150901

I have tried putting 140201 in a variable. But i am not able to append it to the end of the line. Can this be done by sed?

Please tell me if there is any other way i can accomplish it.

Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

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... (4 Replies)
Discussion started by: cstovall
4 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
sane-ma1509(5)						   SANE Scanner Access Now Easy 					    sane-ma1509(5)

NAME
sane-ma1509 - SANE backend for Mustek BearPaw 1200F USB scanner DESCRIPTION
The sane-ma1509 library implements a SANE (Scanner Access Now Easy) backend that provides access to the Mustek BearPaw 1200F USB flatbed scanner. This scanner is based on the MA-1509 chipset. Other scanners that use this chip (if they exist) may also work. This backend is ALPHA software. Be careful and remove the power plug immediately if your hear unusual noises. More details can be found on the ma1509 backend homepage http://www.meier-geinitz.de/sane/ma1509-backend/. Other Mustek USB scanners are supported by the gt68xx, mustek_usb and the plustek backends. See sane-mustek_usb(5), sane-gt68xx(5) and sane-plustek(5) for details. This backend can only work with scanners that are already detected by the operating system. See sane-usb(5) for details. If you own a scanner other than the Mustek BearPaw 1200F that works with this backend, please let me know this by sending the scanner's exact model name and the USB vendor and device ids (e.g. from /proc/bus/usb/devices or syslog) to me. DEVICE NAMES
This backend expects device names of the form: special Where special is a path-name for the special device that corresponds to a USB scanner. With Linux, such a device name could be /dev/usb/scanner0 or libusb:001:002, for example. CONFIGURATION
The contents of the ma1509.conf file is a list of options and device names that correspond to Mustek BearPaw 1200F scanners. Empty lines and lines starting with a hash mark (#) are ignored. Instead of using the device name, the scanner can be autodetected by usb vendor_id product_id statements which are already included into ma1509.conf. This is only supported with Linux 2.4.8 and higher and all systems that support libsub. "vendor_id" and "product_id" are hexadecimal numbers that identify the scanner. If this doesn't work, a device name must be placed in ma1509.conf as described above. To set the time the lamp needs for warm-up, use option warmup-time in ma1509.conf. The time is given in seconds after the option. The default is 30 seconds. FILES
/etc/sane.d/ma1509.conf The backend configuration file (see also description of SANE_CONFIG_DIR below). /usr/lib64/sane/libsane-ma1509.a The static library implementing this backend. /usr/lib64/sane/libsane-ma1509.so The shared library implementing this backend (present on systems that support dynamic loading). ENVIRONMENT
SANE_CONFIG_DIR This environment variable specifies the list of directories that may contain the configuration file. Under UNIX, the directories are separated by a colon (`:'), under OS/2, they are separated by a semi-colon (`;'). If this variable is not set, the configura- tion file is searched in two default directories: first, the current working directory (".") and then in /etc/sane.d. If the value of the environment variable ends with the directory separator character, then the default directories are searched after the explic- itly specified directories. For example, setting SANE_CONFIG_DIR to "/tmp/config:" would result in directories "tmp/config", ".", and "/etc/sane.d" being searched (in this order). SANE_DEBUG_MA1509 If the library was compiled with debug support enabled, this environment variable controls the debug level for this backend. Higher debug levels increase the verbosity of the output. SEE ALSO
sane(7), sane-usb(5), sane-gt68xx(5), sane-plustek(5), sane-mustek_usb(5), sane-mustek(5), sane-mustek_pp(5), http://www.meier-geinitz.de/sane/ma1509-backend/ AUTHOR
Henning Meier-Geinitz <henning@meier-geinitz.de> BUGS
Resolutions higher than 600 dpi don't work Transparency adapter and automatic document feeder is not supported yet No support for "high-speed" mode (jpeg) More detailed bug information is available at the MA-1509 backend homepage http://www.meier-geinitz.de/sane/ma1509-backend/. 13 Jul 2008 sane-ma1509(5)
All times are GMT -4. The time now is 03:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy