Sponsored Content
Top Forums Shell Programming and Scripting parsing file based on characters/bytes Post 302482695 by cheeko111 on Wednesday 22nd of December 2010 10:07:21 AM
Old 12-22-2010
example...any line that has 50 chars goes in one file, everything else goes in the other

Code:
HEADER
12345678901234567890123456789012345678901234567890
123456   John      Doe        1 Main St       asdw
789012   John      Doe      22 Main St      xcdf 
345678   John      Doe        1 Main St       fgty
901234   John      Doe        1 Main St       gg
567890   John      Doe        1 Main St       dety
1122337   John      Doe        1 Main St       lgky
445566   John      Doe        1 Main St       oprd
778899   John      Doe        1 Main St         kgit
EOF


12345678901234567890123456789012345678901234567890
123456   John      Doe        1 Main St       asdw
345678   John      Doe        1 Main St       fgty
567890   John      Doe        1 Main St       dety
445566   John      Doe        1 Main St       oprd


HEADER
789012   John      Doe      22 Main St      xcdf 
901234   John      Doe        1 Main St       gg
1122337   John      Doe        1 Main St       lgky
778899   John      Doe        1 Main St         kgit
EOF

---------- Post updated at 10:07 AM ---------- Previous update was at 10:06 AM ----------

joeyg...........you are correct

Last edited by radoulov; 12-22-2010 at 11:07 AM.. Reason: Code tags, please!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove first N bytes and last N bytes from a binary file on AIX.

Hi all, Does anybody know or guide me on how to remove the first N bytes and the last N bytes from a binary file? Is there any AWK or SED or any command that I can use to achieve this? Your help is greatly appreciated!! Best Regards, Naveen. (1 Reply)
Discussion started by: naveendronavall
1 Replies

2. UNIX for Dummies Questions & Answers

Rename file based on first 3 characters of data in file

I'm looking to determine if I can use a grep command to read file and rename the file based on the first 3 characters of the data in the file. An example is: Read FileA If the first 3 positions of the data in the file are "ITP", then rename the file as FileA_ITP, else if the first 3... (3 Replies)
Discussion started by: jchappel
3 Replies

3. Shell Programming and Scripting

Parsing Log File Based on Date & Error

I'm still up trying to figure this out and it is driving me nuts. I have a log file which has a basic format of this... 2010-10-10 22:25:42 Init block 'UA Deployment Date': Dynamic refresh of repository scope variables has failed. The ODBC function has returned an error. The database... (4 Replies)
Discussion started by: k1ko
4 Replies

4. Shell Programming and Scripting

parsing characters and number from a big file with brackets

I have a big file with many brackets () in it from which I need to parse number characters and numbers. Below is an example of my file 14 (((A__0:0.02,B__1:0.3)0:0.04,C__0:0.025)2:0.01),(D__0:0.00978,E__2:0.01031)1:0.00362; 15... (1 Reply)
Discussion started by: Lucky Ali
1 Replies

5. UNIX for Dummies Questions & Answers

X bytes of 0, Y bytes of random data, Z bytes of 5, T bytes of 1. ??

Hello guys. I really hope someone will help me with this one.. So, I have to write this script who: - creates a file home/student/vmdisk of 10 mb - formats that file to ext3 - mounts that partition to /mnt/partition - creates a file /mnt/partition/data. In this file, there will... (1 Reply)
Discussion started by: razolo13
1 Replies

6. Shell Programming and Scripting

Find unique lines based off of bytes

Hello All, I have two VERY large .csv files that I want to compare values based on substrings. If the lines are unique, then print the line. For example, if I run a diff file1.csv and file2.csv I get results similar to +_id34,brown,car,2006 +_id1,blue,train,1985... (5 Replies)
Discussion started by: jl487
5 Replies

7. Shell Programming and Scripting

Parsing a file based on next line

I have a file1 like ID E2AK1_HUMAN Reviewed; 630 AA. CC -!- SUBCELLULAR LOCATION: Host nucleus {ECO:0000305}. ID E1A_ADEM1 Reviewed; 200 AA. ID E1A_ADES7 Reviewed; 266 AA. CC -!- SUBCELLULAR LOCATION: Host nucleus... (8 Replies)
Discussion started by: sammy777
8 Replies

8. Shell Programming and Scripting

Parsing a file based on positional constraints

I have a list file1 like dog cow fox cat fish duck crowI want to classify the elements of file1 based on constrains applied on file2. Additionally the number of elements (words) in the each line of file2 is not fixed. This is my file2 cow cat fox dog cow fox dog fish crow fox dog cat ... (5 Replies)
Discussion started by: sammy777
5 Replies

9. Shell Programming and Scripting

File Parsing based on a character in a specific field

Hi All, I'm having a hard time finding a starting point for my issue. I have a 30k line file (fspsec.txt) that I would like to parse into smaller files based on any character existing in field 1. ACCOUNTANT LEVEL 1 (ACCT.ACCOUNTANT) OPERATORS: DOEJO (418) TOOLS: Branch Maintenance ... (2 Replies)
Discussion started by: aahlrich
2 Replies

10. Shell Programming and Scripting

Parsing a file containing special characters

I want to parse a file containing special characters, below is a sample content of file content of file : Serial_no:1$$@#first_name:Rahane$$@last_name:Ajiyenke@@#profession:cricketer!@#*&^ Serial_no:1$$@#first_name:Rahane$$@last_name:Ajiyenke@@#profession:cricketer!@#*&^... (3 Replies)
Discussion started by: rajMjar
3 Replies
Net::DNS::Mailbox(3)					User Contributed Perl Documentation				      Net::DNS::Mailbox(3)

NAME
Net::DNS::Mailbox - DNS mailbox representation SYNOPSIS
use Net::DNS::Mailbox; $mailbox = new Net::DNS::Mailbox('user@example.com'); $address = $mailbox->address; DESCRIPTION
The Net::DNS::Mailbox module implements a subclass of DNS domain name objects representing the DNS coded form of RFC822 mailbox address. METHODS
new $mailbox = new Net::DNS::Mailbox('John.Doe@example.com'); $mailbox = new Net::DNS::Mailbox('John Doe <j.doe@example.com>'); Creates a mailbox object which represents the DNS domain encoded form of the mail address specified by the character string argument. The argument string consists of printable characters from the 7-bit ASCII repertoire. address $address = $mailbox->address; Returns a character string containing the RFC822 mailbox address corresponding to the encoded domain name representation described in RFC1035 section 8. DOMAIN NAME COMPRESSION AND CANONICALISATION
The Net::DNS::Mailbox1035 and Net::DNS::Mailbox2535 subclass packages implement RFC1035 domain name compression and RFC2535 canonicalisation. COPYRIGHT
Copyright (c)2009,2012 Dick Franks. All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
perl, Net::DNS, Net::DNS::DomainName, RFC822, RFC1035, RFC5322 perl v5.16.3 2012-12-28 Net::DNS::Mailbox(3)
All times are GMT -4. The time now is 06:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy