01-08-2009
#! /bin/ksh
open FH,"a.txt";
while(<FH>){
chomp;
my @arr=(substr($_,0,1),substr($_,1,6),substr($_,7,6),substr($_,13,2),substr($_,15,8),substr($_,23,8),s ubstr($_,31,8),substr($_,39,8),substr($_,47,2));
for($j=1;$j<=2;$j++){
for($i=4;$i<=7;$i++){
print $arr[0].$arr[$j].$arr[3].$arr[$i].$arr[$#arr]."\n";
}
}
}
i am getting the following error!!
dd_code.sh[2]: open: not found
dd_code.sh[3]: syntax error at line 3 : `)' unexpected
please advise...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am trying to read 2 files and writing to the 3rd file if I find the same elements in 2 files. my first file is
1 0 kb12124819 766409 1.586e-01
1 0 kb17160939 773886 8.674e-01
1 0 kb4475691 836671 8.142e-01
1 0 ... (2 Replies)
Discussion started by: ezhil01
2 Replies
2. Shell Programming and Scripting
Hi,
I am new to scripting. I need a script to sort and the records in a file and then split them into different files.
For example, the file is:
H1......................
H2......................
D2....................
D2....................
H1........................... (15 Replies)
Discussion started by: Sunitha_edi82
15 Replies
3. Shell Programming and Scripting
Input
217:fngadi4osa:fngadi4osa:M 217:415744:N/A
227:fngadi4osa:fngadi4osa: M 227:51200:N/A
228:fngadi4osa:fngadi4osa: M 228:102400:N/A
65:sapgt04:sapgt04: M 65:104448:N/A
228:fngadi4osa:fngadi4oma: M 228:102400:N/A
Output
217:fngadi4osa:fngadi4osa:M 217:415744:N/A... (3 Replies)
Discussion started by: greycells
3 Replies
4. Shell Programming and Scripting
cat file1.txt
field1 "user1":
field2:"data-cde"
field3:"data-pqr"
field4:"data-mno"
field1 "user1":
field2:"data-dcb"
field3:"data-mxz"
field4:"data-zul"
field1 "user2":
field2:"data-cqz"
field3:"data-xoq"
field4:"data-pos"
Now i need to have the date like below.
i have just... (7 Replies)
Discussion started by: ckaramsetty
7 Replies
5. Shell Programming and Scripting
Hi All,
I am new to forum, I am looking to arrange a file in specific format but unable to get the formula to do it, already googled for the same, but didnt find the answer :(. hope to get help here :o:o:o:o:o
I have to files :
$ cat Dev_List2
0685
0686
0687
0688
0689
068A
068B
068C... (2 Replies)
Discussion started by: prasan_Aix
2 Replies
6. UNIX for Dummies Questions & Answers
Hi all,
I have a input file say record.txt
hostname IP_address Port_No Version
A 10.10.10.1 80 6.02
B 10.10.10.2 81 6.03
C 10.10.10.3 82 6.04
row 1 has 4 field headings : hostname, IP_address, Port_No and Version.
and from 2nd row onwards the actual records start.
now i need to... (2 Replies)
Discussion started by: PranavEcstasy
2 Replies
7. Programming
Hello everyone,
I have some problem about this code :
#!/usr/bin/env python
import sys
try :
filename = sys.argv
except :
print 'Specify filename'
sys.exit()
fd = open(filename)
lines = fd.xreadlines()
compare = {}
for line in lines :
split_line =... (1 Reply)
Discussion started by: awil
1 Replies
8. Shell Programming and Scripting
Hello Experts,
Below is the record i have:
sample data attached
I want this record of each row to be in single line and there are multiple rowise unixtime mentioned e.g 11996327 , This needs to be converted to Human readdable data and time from multiple rows
Can you help me , it will be... (10 Replies)
Discussion started by: manishK
10 Replies
9. UNIX for Dummies Questions & Answers
I have a file named: learn.999 that has the following format where each record is separated by ^M as follows:
... (11 Replies)
Discussion started by: mrn6430
11 Replies
10. UNIX for Advanced & Expert Users
Dear All,
I want to get all the IPs of the A RECORDS for mail.google.com.
The aim is to deny access to these IPs.
I learnt that mail.google.com has several IPs.
I did the following steps:
1. whois google.com
2. I got the following as its DOMAIN SERVERS:
3.# dig @ns1.google.com a... (1 Reply)
Discussion started by: coolatt
1 Replies
LEARN ABOUT DEBIAN
srec_msbin
srec_msbin(5) File Formats Manual srec_msbin(5)
NAME
srec_msbin - Windows CE Binary Image Data Format
DESCRIPTION
This format is the output of the Microsoft WinCE Platform Builder. This is a binary (non-text) file format. File names in this format
typically (ambiguously) use the .bin suffix.
File Format
Files in this format start with a header record.
Then comes the data itself, organized into records.
The file finishes with an execution start address record. This is mandatory.
File Header Record
Data in this format start with an optional header containing the magic "B000FF
", followed by the image start (four bytes, little endian)
address and the span of the image (highest address - lowest address + 1) (four bytes, little endian). The file header does not have a
checksum; it is therefore possible that a corrupt file header will go undetected.
+-----------+------------+------------+
|Magic | Least | Greatest |
|"B000FF
" | Address | Address |
|(7 bytes) | (4 bytes) | (4 bytes) |
There-is-no-provision-for+a-file-comment of any kind.
Data Record
Each record consists of a record start address (four bytes, little endian), a record length (four bytes, little endian), a record checksum
(four bytes, little endian), followed by the record data. The data part of each record is raw byte values, no encoding.
+----------+-----------+-----------+-----------+
|Start | Length | Checksum | Data |
|address | (4 bytes) | (4 bytes) | |
|(4 bytes) | | | |
+----------+-----------+-----------+-----------+
The checksum is calculated by a simple sum of unsigned bytes into a 32-bit accumulator.
The 12 record header bytes are not included in the record checksums; it is therefore possible that a corrupt record header will go unde-
tected.
It is not possible to place data at address zero with this format. Address zero is reserved for use by the execution start address record.
There is effectively no limit on the length of a record (2^32-1). It is not uncommon for a MsBin file to contain records with sizes in the
tens of megabytes.
Execution Start Address Record
Last comes a special record with the record address set to zero and record length set to the image execution start address. According to
specification the record describing the execution start address must be always present, and must always be the last record in the file.
+----------+-----------+-----------+
|Zero | Start | Checksum |
|(4 bytes) | Address | = 0 |
| | (4 bytes) | (4 bytes) |
+----------+-----------+-----------+
Commentary
The MsBin files produced by SRecord are valid and can be successfully parsed by the command line utilities viewbin and cvrtbin (part of
Windows CE platform).
For a MsBin file to be usable in Microsoft WinCE Platform Builder it has to contain a TOC meta-structure. This is data embedded in the
file by Microsoft WinCE Platform Builder itself.
The opposite conversion - from MsBin - comes in handy when analyzing a MsBin file (i.e. a WinCE image).
Size Multiplier
In general, binary data will expand in sized by approximately 1.0 times (approaching asymptotically from above) when represented with this
format, as the 15-byte file header is averaged over the data content. Holes in the data will also increase the size.
SOURCE
http://msdn.microsoft.com/en-us/library/ms924510.aspx
COPYRIGHT
srec_cat version 1.58
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Peter Miller
The srec_cat program comes with ABSOLUTELY NO WARRANTY; for details use the 'srec_cat -VERSion License' command. This is free software and
you are welcome to redistribute it under certain conditions; for details use the 'srec_cat -VERSion License' command.
AUTHOR
Peter Miller E-Mail: pmiller@opensource.org.au
//* WWW: http://miller.emu.id.au/pmiller/
Reference Manual SRecord srec_msbin(5)