Sponsored Content
Top Forums Shell Programming and Scripting Counting the number of characters Post 302600104 by Sri3001 on Monday 20th of February 2012 05:44:22 AM
Old 02-20-2012
Thank you Scrutinizer,

Can you please explain me the logic , because this is just one step of my requirement i need to do some more steps in this , I would need the o/p of that 5th Coloumn , My final o/p should look something like this

I/p:
1157,306413,R,2009,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,,0,0,0,0,0,0,0,0,0,5,405,0,0,102,102,102,102,102,102,102,103,102,102,102 ,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102 ,102,102,102,,102,102,102,102,102,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

O/p:
1157,306413,R,2009,113,5,405,0,0,102,102,102,102,102,102,102,103,102,102,102,102,102,102,102,102,102 ,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,,102,102,10 2,102,102,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,0,0,0,0,0,0,0,0,0

I need to remove the zeros or null before the non zero character and append it at the end so that my coloumn count remains the same

Many thanks in advance

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

counting characters

Dears, I would like to count the number of "(" and ")" that occur in a file. (syntax checking script). I tried to use "grep -c" and this works fine as long as there is only one character (for which I do a search) on a line. Has anyone an idea how I can count the number of specific characters... (6 Replies)
Discussion started by: plelie2
6 Replies

2. Shell Programming and Scripting

Counting characters between comma's

I have a comma delimited file that roughly has 300 fields. Not all fields are populated. This file is fed into another system, what I need to do is count the amount of characters in each field and give me an output similiar to this: 1 - 6,2 - 25 The first number is the field and the second... (2 Replies)
Discussion started by: dbrundrett
2 Replies

3. UNIX for Dummies Questions & Answers

counting the occurence of particular characters

I want to list the occurence of particular characters in a line. my file looks like this a,b,c,d e,f,g h,y:e,g,y s f;g,s,w and I want to count how many commas are in each line so the file in the end looks like this: a,b,c,d 3 e,f,g 2 h,y:e,g,y s 3 f;g,s,w ... (2 Replies)
Discussion started by: Audra
2 Replies

4. Shell Programming and Scripting

Counting the number of occurances of all characters (a-z) in a string

Hi, I am trying out different scripts in PERL. I want to take a line/string as an input from the user and count the number of occurrances of all the alphabets (a..z) in the string. I tried doingit like this : #! /opt/exp/bin/perl print "Enter a string or line : "; $string = <STDIN>; chop... (5 Replies)
Discussion started by: rsendhilmani
5 Replies

5. Shell Programming and Scripting

counting characters

Hi All, I need some help in counting the number of letters in a big file with separations. Following is the file I have >AB_1 MLKKPIIIGVTGGSGGGKTSVSRAILDSFPNARIAMIQHDSYYKDQSHMSFEERVKTNYDHPLAFDTDFM IQQLKELLAGRPVDIPIYDYKKHTRSNTTFRQDPQDVIIVEGILVLEDERLRDLMDIKLFVDTDDDIRII... (6 Replies)
Discussion started by: Lucky Ali
6 Replies

6. Shell Programming and Scripting

Counting characters with sed

Input: ghw//yw/hw///??u How can i count the slashes("/") using sed? (13 Replies)
Discussion started by: cola
13 Replies

7. Shell Programming and Scripting

counting the number of characters in the filename of all files in a directory?

I am trying to display the output of ls and also print the number of characters in EVERY file name. This is what I have so far: #!/bin/sh for x in `ls`; do echo The number of characters in x | wc -m done Any help appreciated (1 Reply)
Discussion started by: LinuxNubBrah
1 Replies

8. Shell Programming and Scripting

Counting characters vertically

I do have a big file in the following format >A1 ATGCGG >A2 TCATGC >A3 -TGCTG The number of characters will be same under each subheader and only possible characters are A,T,G,C and - I want to count the number of A's, T's,G's, C's & -'s vertically for all the positions so that I... (5 Replies)
Discussion started by: Lucky Ali
5 Replies

9. Shell Programming and Scripting

Counting characters at each position

Hi All, here's a question from newbie I have a data like this, which set of small DNA sequences separated by new line GAATCCGGAAACAGCAACTTCAAANCA GTNATTCGGGCCAAACTGTCGAA TTNGGCAACTGTTAGAGCTCATGCGACA CCTGCTAAACGAGTTCGAGTTGAANGA TTNCGGAAGTGGTCGCTGGCACGG ACNTGCATGTACGGAGTGACGAAACCI... (6 Replies)
Discussion started by: amits22
6 Replies
slxdecode(1)						      General Commands Manual						      slxdecode(1)

NAME
slxdecode - Decode a SLX stream into human readable form. SYNOPSIS
slxdecode [options] <slx-file DESCRIPTION
slxdecode decodes a SLX stream into human readable form. A SLX stream is the printer langauge used by some Lexmark printers, such as the C500. More information on the Software Imaging K.K. SLX stream can be found at: http://softwareimaging.com/products-services/sorcerer/index.asp COMMAND LINE OPTIONS
These are the options that can appear on the command line. -d basename Basename of .pbm file for saving decompressed planes. -r basename Basename of .jbg file for saving raw planes -h Print hex file offsets. -o Print file offsets. -D level Set Debug level [0]. EXAMPLES
Decode an SLX file created by foo2slx. $ slxdecode < testpage.zm SLX_MAGIC, 0x584c53a5 (SLX) SLT_START_DOC, 12 items SLI_PAGECOUNT, 4294967295 (0xffffffff) SLI_DMDUPLEX, 0 (0x0) SLI_DMCOLLATE, 0 (0x0) SLI_0x3, 0 (0x0) SLI_DISPLAY, 0 (0x0) SLI_0x5, 0 (0x0) SLI_0x6, 0 (0x0) SLI_0x7, 1 (0x1) SLI_0x8, 0 (0x0) SLI_0x9, 0 (0x0) SLI_COUNT, 1 (0x1) SLI_DMCOLLATE, 0 (0x0) SLT_START_PAGE, 16 items [Page 1] SLI_DMPAPER, 6 (0x6) SLI_CUSTOM_X, 0 (0x0) SLI_CUSTOM_Y, 0 (0x0) SLI_DMCOPIES, 1 (0x1) SLI_DMDEFAULTSOURCE, 0 (0x0) SLI_DMMEDIATYPE, 0 (0x0) SLI_NBIE, 0 (0x0) SLI_RESOLUTION_X, 600 (0x258) SLI_RESOLUTION_Y, 600 (0x258) SLI_OFFSET_X, 102 (0x66) SLI_OFFSET_Y, 102 (0x66) SLI_RASTER_X, 4896 (0x1320) SLI_RASTER_Y, 6392 (0x18f8) SLI_0x10d, 4896 (0x1320) SLI_0x10e, 6392 (0x18f8) SLI_0x10f, 1 (0x1) SLT_JBIG_BIH, 0 items Data: 20 bytes DL = 0, D = 0, P = 1, - = 0, XY = 4896 x 6392 L0 = 128, MX = 0, MY = 0 Order = 0 Options = 8 TPBON 50 stripes, 0 layers, 1 planes SLT_JBIG_BID, 0 items Data: 116 bytes SLT_END_JBIG, 0 items SLT_END_PAGE, 0 items SLT_END_DOC, 0 items FILES
/usr/bin/slxdecode SEE ALSO
foo2slx-wrapper(1), foo2slx(1), jbg2pbm(1) AUTHOR
Rick Richardson <rick.richardson@comcast.net> http://foo2slx.rkkda.com/
All times are GMT -4. The time now is 05:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy