Sponsored Content
Full Discussion: shell script required
Operating Systems Linux shell script required Post 302125766 by robotronic on Saturday 7th of July 2007 05:04:27 AM
Old 07-07-2007
I'm sure there's a more elegant way to do this, but a rapid solution could be:

Code:
sed "/^01/d; /^02/d; s/\^//g; s/^..//" 71018158.txt | split -32 - 71018158.part.
wc -m 71018158.part.*
rm 71018158.part.*

-----------------------------------------------------------

./script.sh
264 71018158.part.aa
284 71018158.part.ab
301 71018158.part.ac
849 total

I suppose that you don't wanna count characters belonging to the number of records at the beginning of each line (01, 02, 03...), otherwise you have to remove "s/^..//".

I also assume that the rows in your input file that aren't numbered (e.g. the line after the 32nd row in the first block of text) is actually a single long line (the continuation of 32nd row). If this isn't a mistake you've done with copy/paste, my script won't work Smilie

Bye
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script required

hi , i need a shell script that will remove the first and second lines of the text file and will list the word count of the characters present in it. the text file will be consisting of multiple textfiles.the first text file starts from 01-34.like wise the next file also starts from 01-34... (4 Replies)
Discussion started by: sethunath
4 Replies

2. Shell Programming and Scripting

Shell Script Required!

Hi people, I am new to this forum. I have taken unix this semester in my college and i am new to it. I am finding shell scripting a bit hard and i need a little help. I require a shell script to delete files that end as .bak , .BAK, #, ~ and files with the name core.The Script should accept... (3 Replies)
Discussion started by: vats
3 Replies

3. Shell Programming and Scripting

Shell Script Required

I have following information in one file. ObjID: 004ee4e4-0d92-71dd-1512-9887a1f10000 Address: 152.135.0.61 PingState: Ping Responding ----------------Management Address--------------------- ++++++++++++++++Interface+++++++++++++++++++++ IFName: dall00r1.mis.amat.com ] ObjID:... (3 Replies)
Discussion started by: ntgobinath
3 Replies

4. Shell Programming and Scripting

Shell script help required

Hi, Can someone help me with this small piece of code. DIRNAME=$(dirname $0) BASENAME=$(basename $0) DATA="${DIRNAME}/${BASENAME}.data" && . $DATA whats is meant by && . $DATA here... Regards, Abhishek (2 Replies)
Discussion started by: max29583
2 Replies

5. Shell Programming and Scripting

Small shell script help required

Hi Guys, Please can some one explain me the below part of code. In this code what is the use of the line in Bold. COPY=0 if ; then echo "$CONF exists and is non-empty - backing it up" SUFFIX=`date +%Y%m%d%H%M%S` echo "cp -p $CONF $CONF.$SUFFIX" cp -p $CONF... (4 Replies)
Discussion started by: max29583
4 Replies

6. Shell Programming and Scripting

shell script required...

There are two fields actually one is server name and the other one is Time. Based on time, there are 8 columns and these will be updated with the flag 1 if at all if there is any server name. Time Server name 15 to 18 18 to 21 21 to 24 00 to 03 03 to 06 06 to 09 09 to 12 Server... (3 Replies)
Discussion started by: venkatesht
3 Replies

7. Shell Programming and Scripting

Shell script is required

Dear All I have a filelisting as below: abcd_20110715_0007 abcd_20110715_0010 abcd_20110716_0001 abcd_20110716_0004 abcd_20110715_0008 abcd_20110715_0011 abcd_20110716_0002 abcd_20110716_0005 abcd_20110715_0009 abcd_20110715_0012 abcd_20110716_0003 abcd_20110716_0006 ... (3 Replies)
Discussion started by: at1700
3 Replies

8. Shell Programming and Scripting

help required with shell script

Hi, My input file as follws $ cat 1.txt ------- a aa aaa 11 b bb bbb 22 I am able to extract first and last column of a given line as follows. $ nawk '{print $1}' FS= RS= 1.txt | awk '{ $NF = ""; print }' a $ nawk '{print $1}' FS= RS= 1.txt | awk '{ print $NF}' 11 however, the... (4 Replies)
Discussion started by: bala123
4 Replies

9. UNIX for Dummies Questions & Answers

Shell script required

Hi, I need shell script for getting the date in format from below text output IP IS 10.238.52.65 pun-ras-bng-mhs-01#show conf port 2/4 Building configuration... Current configuration: ! card ge3-4-port 2 ! port ethernet 2/4 no shutdown encapsulation dot1q (7 Replies)
Discussion started by: surender reddy
7 Replies
PDLACPY(l)					      LAPACK auxiliary routine (version 1.5)						PDLACPY(l)

NAME
PDLACPY - copie all or part of a distributed matrix A to another distributed matrix B SYNOPSIS
SUBROUTINE PDLACPY( UPLO, M, N, A, IA, JA, DESCA, B, IB, JB, DESCB ) CHARACTER UPLO INTEGER IA, IB, JA, JB, M, N INTEGER DESCA( * ), DESCB( * ) DOUBLE PRECISION A( * ), B( * ) PURPOSE
PDLACPY copies all or part of a distributed matrix A to another distributed matrix B. No communication is performed, PDLACPY performs a local copy sub( A ) := sub( B ), where sub( A ) denotes A(IA:IA+M-1,JA:JA+N-1) and sub( B ) denotes B(IB:IB+M-1,JB:JB+N-1). Notes ===== Each global data object is described by an associated description vector. This vector stores the information required to establish the mapping between an object element and its corresponding process and memory location. Let A be a generic term for any 2D block cyclicly distributed array. Such a global array has an associated description vector DESCA. In the following comments, the character _ should be read as "of the global array". NOTATION STORED IN EXPLANATION --------------- -------------- -------------------------------------- DTYPE_A(global) DESCA( DTYPE_ )The descriptor type. In this case, DTYPE_A = 1. CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating the BLACS process grid A is distribu- ted over. The context itself is glo- bal, but the handle (the integer value) may vary. M_A (global) DESCA( M_ ) The number of rows in the global array A. N_A (global) DESCA( N_ ) The number of columns in the global array A. MB_A (global) DESCA( MB_ ) The blocking factor used to distribute the rows of the array. NB_A (global) DESCA( NB_ ) The blocking factor used to distribute the columns of the array. RSRC_A (global) DESCA( RSRC_ ) The process row over which the first row of the array A is distributed. CSRC_A (global) DESCA( CSRC_ ) The process column over which the first column of the array A is distributed. LLD_A (local) DESCA( LLD_ ) The leading dimension of the local array. LLD_A >= MAX(1,LOCr(M_A)). Let K be the number of rows or columns of a distributed matrix, and assume that its process grid has dimension p x q. LOCr( K ) denotes the number of elements of K that a process would receive if K were distributed over the p processes of its process col- umn. Similarly, LOCc( K ) denotes the number of elements of K that a process would receive if K were distributed over the q processes of its process row. The values of LOCr() and LOCc() may be determined via a call to the ScaLAPACK tool function, NUMROC: LOCr( M ) = NUMROC( M, MB_A, MYROW, RSRC_A, NPROW ), LOCc( N ) = NUMROC( N, NB_A, MYCOL, CSRC_A, NPCOL ). An upper bound for these quantities may be computed by: LOCr( M ) <= ceil( ceil(M/MB_A)/NPROW )*MB_A LOCc( N ) <= ceil( ceil(N/NB_A)/NPCOL )*NB_A ARGUMENTS
UPLO (global input) CHARACTER Specifies the part of the distributed matrix sub( A ) to be copied: = 'U': Upper triangular part is copied; the strictly lower triangular part of sub( A ) is not referenced; = 'L': Lower triangu- lar part is copied; the strictly upper triangular part of sub( A ) is not referenced; Otherwise: All of the matrix sub( A ) is copied. M (global input) INTEGER The number of rows to be operated on i.e the number of rows of the distributed submatrix sub( A ). M >= 0. N (global input) INTEGER The number of columns to be operated on i.e the number of columns of the distributed submatrix sub( A ). N >= 0. A (local input) DOUBLE PRECISION pointer into the local memory to an array of dimension (LLD_A, LOCc(JA+N-1) ). This array contains the local pieces of the distributed matrix sub( A ) to be copied from. IA (global input) INTEGER The row index in the global array A indicating the first row of sub( A ). JA (global input) INTEGER The column index in the global array A indicating the first column of sub( A ). DESCA (global and local input) INTEGER array of dimension DLEN_. The array descriptor for the distributed matrix A. B (local output) DOUBLE PRECISION pointer into the local memory to an array of dimension (LLD_B, LOCc(JB+N-1) ). This array contains on exit the local pieces of the distributed matrix sub( B ) set as follows: if UPLO = 'U', B(IB+i-1,JB+j-1) = A(IA+i-1,JA+j-1), 1<=i<=j, 1<=j<=N; if UPLO = 'L', B(IB+i-1,JB+j-1) = A(IA+i-1,JA+j-1), j<=i<=M, 1<=j<=N; otherwise, B(IB+i-1,JB+j-1) = A(IA+i-1,JA+j-1), 1<=i<=M, 1<=j<=N. IB (global input) INTEGER The row index in the global array B indicating the first row of sub( B ). JB (global input) INTEGER The column index in the global array B indicating the first column of sub( B ). DESCB (global and local input) INTEGER array of dimension DLEN_. The array descriptor for the distributed matrix B. LAPACK version 1.5 12 May 1997 PDLACPY(l)
All times are GMT -4. The time now is 10:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy