Sponsored Content
Top Forums Shell Programming and Scripting Record length check fails due to '\' character Post 302786211 by hergp on Wednesday 27th of March 2013 05:25:35 AM
Old 03-27-2013
When you run wc -l, it gives you the number of lines in the file, not the record lengths. What other command did you use to get the record lengths?

---------- Post updated at 10:25 ---------- Previous update was at 10:24 ----------

One way to get the record lengths would be

Code:
$ awk '{ print length($0) }' inputfile
10
11
9

which gives you the desired output.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using Awk script to check length of a character

Hi All , I am trying to build a script using awk that checks columns of the înput file and displays message if the column length exceeds 35 char. i have tried the below code but it does not work properly (2 Replies)
Discussion started by: amit1_x
2 Replies

2. UNIX for Dummies Questions & Answers

What the command to find out the record length of a fixed length file?

I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies

3. Shell Programming and Scripting

Check length of record

Hi, I have a problem, please help me, I have a flat file like this: P00000000088888888999999999 0000999903 000000000000000000 P00000000077777777000000000 0000999903 000000000000000000 P00000000044444444333333333 0000999903 00000000000000000079875 P00000000066666666111111111 0000999903 ... (5 Replies)
Discussion started by: DebianJ
5 Replies

4. Shell Programming and Scripting

Make variable length record a fixed length

Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types: (H)eader Records (D)etail Records (T)railer Records The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies

5. Shell Programming and Scripting

Add character based on record length

All, I can't seem to find exactly what I'm looking for, and haven't had any luck patching things together. I need to look through a file, and if the record length is not 874, then add 'E' in position 778. Your help is greatly appreciated. (4 Replies)
Discussion started by: CutNPaste
4 Replies

6. OS X (Apple)

Compiling fails due to space in path to home folder

I seem to have issues compiling software and I think I've narrowed it down to something having to do with having a space in the path name to my Home folder (which contains "Macintosh HD"). The reason I think this is shown here: $ echo $HOME /Volumes/Macintosh HD/Users/Tom $ cd $HOME -sh:... (7 Replies)
Discussion started by: tdgrant1
7 Replies

7. Shell Programming and Scripting

Check for length which exceeds specified length in a line

Hi, I have a issue, I need to loop through a comma delimited file and check for the length which exceeds specified length , if Yes truncate the string. But my problem is , I do not have to check for all the fields and the field lenght is not same for all the fields. For ex: Say my line... (9 Replies)
Discussion started by: rashmisb
9 Replies

8. Shell Programming and Scripting

Convert variable length record to fixed length

Hi Team, I have an issue to split the file which is having special chracter(German Char) using awk command. I have a different length records in a file. I am separating the files based on the length using awk command. The command is working fine if the record is not having any... (7 Replies)
Discussion started by: Anthuvan
7 Replies

9. Shell Programming and Scripting

Ssh fails due to argument position.

I have a constraint to follow organization policy. So i do not have much liberty. ssh -i /opt/nonprod user1@hostone -t bash works while ssh -i /opt/nonprod -t bash user1@hostone fails How can I get this to work when I am enforced to put -t bash before the user@hostname ? Will share debug... (3 Replies)
Discussion started by: mohtashims
3 Replies
LTDBTOOL(1)						   CTDB - clustered TDB database					       LTDBTOOL(1)

NAME
ltdbtool - manipulate CTDB's local TDB files SYNOPSIS
ltdbtool [OPTION...] {COMMAND} [COMMAND-ARGS] DESCRIPTION
ltdbtool is a utility to manipulate CTDB's local TDB databases (LTDBs) without connecting to a CTDB daemon. It can be used to: o dump the contents of a LTDB, optionally printing the CTDB record header information, o convert between an LTDB and a non-clustered tdb by adding or removing CTDB headers and o convert between 64 and 32 bit LTDBs where the CTDB record headers differ by 4 bytes of padding. OPTIONS
-e Dump empty records. These are normally excluded. -p Dump with header information, similar to "ctdb catdb". -s {0 | 32 | 64} Specify how to determine the CTDB record header size for the input database: 0 no CTDB header 32 CTDB header size of a 32 bit system (20 bytes) 64 CTDB header size of a 64 bit system (24 bytes) The default is 32 or 64 depending on the system architecture. -o {0 | 32 | 64} Specify how to determine the CTDB record header size for the output database, see -s. -S SIZE Explicitly specify the CTDB record header SIZE of the input database in bytes. -O SIZE Explicitly specify the CTDB record header SIZE for the output database in bytes. -h Print help text. COMMANDS
help Print help text. dump IDB Dump the contents of an LTDB input file IDB to standard output in a human-readable format. convert IDB ODB Copy an LTDB input file IDB to output file ODB, optionally adding or removing CTDB headers. EXAMPLES
Print a local tdb in "tdbdump" style: ltdbtool dump idmap2.tdb.0 Print a local tdb with header information similar to "ctdb catdb": ltdbtool dump -p idmap2.tdb.0 Strip the CTDB headers from records: ltdbtool convert -o0 idmap2.tdb.0 idmap.tdb Strip 64 bit CTDB headers from records, running on i386: ltdbtool convert -s64 -o0 idmap2.tdb.0 idmap.tdb Strip the CTDB headers from records by piping through tdbrestore: ltdbtool dump idmap2.tdb.0 | tdbrestore idmap.tdb Convert a local tdb from a 64 bit system for usage on a 32 bit system: ltdbtool convert -s64 -o32 idmap2.tdb.0 idmap2.tdb.1 Add a default header: ltdbtool convert -s0 idmap.tdb idmap2.tdb.0 SEE ALSO
ctdb(1), tdbdump(1), tdbrestore(1), ctdb(7), http://ctdb.samba.org/ AUTHOR
This documentation was written by Gregor Beck COPYRIGHT
Copyright (C) 2011 Gregor Beck, Michael Adam This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses. ctdb 11/27/2013 LTDBTOOL(1)
All times are GMT -4. The time now is 12:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy