Sponsored Content
Top Forums Shell Programming and Scripting Block of code replacement in Java source code through Unix script Post 302593117 by Shell_Life on Wednesday 25th of January 2012 05:19:04 PM
Old 01-25-2012
See if this works for you:
Code:
#!/usr/bin/ksh
typeset -i mCnt
typeset -i mFlag
rm -f File.out
while read mLine; do
  mCnt=$(echo ${mLine} | grep -c 'finally[ ]*{')
  if [[ ${mCnt} != 0 ]]; then
    mFlag=1
    while [[ ${mFlag} != 0 ]]; do
      read mLine
      mCnt=$(echo ${mLine} | grep -c '{')
      if [[ ${mCnt} != 0 ]]; then
        mFlag=${mFlag}+1
      fi
      mCnt=$(echo ${mLine} | grep -c '}')
      if [[ ${mCnt} != 0 ]]; then
        mFlag=${mFlag}-1
      fi
    done
  else
    echo ${mLine} >> File.out
  fi
done < File.in

 

7 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

the source code of unix

tha ithela na moy peite an mporo apo kapoy na vro ton pigaio kvdika toy unix se glossa c .efxaristo. (1 Reply)
Discussion started by: matsoyka
1 Replies

2. Post Here to Contact Site Administrators and Moderators

Source Code Of Unix

Do you have the source code of UNIX? If yes, can you please send it to me on my email email address deleted For your this help I shall be obliged to you. With Regards rajesh ***phone removed*** (1 Reply)
Discussion started by: rajesh_ranjan26
1 Replies

3. Linux

how to get source code of Unix commands?

Can anyone tell me how/where to get the source code for the unix commands like "ls ,finger,cp....etc" commands . I have tried very hard but failed so far. Thanks JAGDISH MACHHI (4 Replies)
Discussion started by: jagdish.machhi@
4 Replies

4. Programming

Exception Signal 11 while running JAVA code in UNIX

Hi, when i compile my java code in UNIX using javac, the class file is getting created. But when i try to run the code using java - classpath command, i get the following error. ---------------------------------------- /u/up11/sample/request:>java -classpath /u/up11/sample/request... (0 Replies)
Discussion started by: satish2712
0 Replies

5. Programming

I have C++ exe file( no source code) and need to run many large dataset under unix, b

I have C++ exe file( no source code) and need to run many large dataset under unix, but how to know the memeroy usage for one dataset?http://www.codeproject.com/script/Forums/Images/New.gif I think "top" is not good and if using the profiler, it seems no free download, any ideas? (1 Reply)
Discussion started by: Danielwang1986
1 Replies

6. UNIX for Advanced & Expert Users

Source code for Unix commands

hi Folks!! Just got a question in mind.... Is it possible for us to read the c code of the commands in the bin directory? I work on a LINUX server and i only see executables in the bin directory which i obviously can't read. Please help me regarding this. Thanks in advance and wishing you a very... (2 Replies)
Discussion started by: bdiwakarteja
2 Replies

7. UNIX for Dummies Questions & Answers

Where can i get unix source code?

Sir please tell me where can i get source code for some unix kernal and shell also. (1 Reply)
Discussion started by: VIPUL15
1 Replies
echo(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.10 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 07:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy