Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Strings comparing incorrectly Post 302620311 by fpmurphy on Saturday 7th of April 2012 11:04:21 PM
Old 04-08-2012
The more modern syntax is
Code:
while read x
do
    if (( charCount < ${#x} ))
    then
        charCount=${#x}
        longest=$x
    fi
done < $1

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

comparing two strings

Hi How do i compare two strings in shell script. Below is an example but I am not getting the desired output, plz help if then echo success fi I am not getting the desired output if I do this. plz help (24 Replies)
Discussion started by: ragha81
24 Replies

2. UNIX for Advanced & Expert Users

Comparing strings

I have two strings a=Mar22 b=may21 how can I compare them Is this fine if then; . ... else .... fi or if then (2 Replies)
Discussion started by: yakyaj
2 Replies

3. Shell Programming and Scripting

Comparing Two Strings

Hi All, While I am trying to run below code I Am getting the exception like ./abs.sh: line 102: syntax error near unexpected token `then' ./abs.sh: line 102: ` then' The Code Snippet is: if then cat $file1 | sed -e... (8 Replies)
Discussion started by: Anji
8 Replies

4. Shell Programming and Scripting

comparing strings

i have a string in a file which gets repeated number of times like below: rpttxt("abc") . . rpttxt("REP_TITLE") rpttxt("BOS_TITLE") . . . . and so on using awk or grep how can i comapre the string( as the second half keeps varying) and store it in a temporary variable? I am using the... (3 Replies)
Discussion started by: agarwal
3 Replies

5. Shell Programming and Scripting

comparing 2 strings

hi i have 2 strings. i want to compare the strings. please help (2 Replies)
Discussion started by: satish@123
2 Replies

6. Shell Programming and Scripting

comparing two strings

hi All i am facing prob in comparing two strings that have two word. below is the code snippet. checkValidates="file validates" file3_name="file" if then echo "file" $file3_name "is validated successfully" fi when i run this i get the error as -bash: [: too many arguments ... (1 Reply)
Discussion started by: infyanurag
1 Replies

7. Shell Programming and Scripting

Comparing strings using nawk

Hello All Please I have got a file called DATE.tex which consist of 01-04-2008_12:00:00 01-04-2005_12:00:00 01-04-2003_12:00:00 01-04-2007_12:00:00 01-04-2002_12:00:00 01-04-2009_12:00:00 I want to use nawk to print out the dates >=01-04-2009_12:00:00 I tried this cat plnt.new |... (6 Replies)
Discussion started by: ganiel24
6 Replies

8. Shell Programming and Scripting

Comparing strings with sed

Input: The the the the Output: not-same same What would be the sed command to do this? (7 Replies)
Discussion started by: cola
7 Replies

9. Shell Programming and Scripting

Help with Comparing 2 strings from text

Hey guys how do I compare 2 strings from the text file, and check for duplication? For example, I add an item call Laptop, it will record to the textfile call file. If it detects duplicate it will say the record record exist? file.txt contains Laptop:Sony:1000 Phone:Apple:30 A head... (4 Replies)
Discussion started by: aLHaNz
4 Replies

10. Shell Programming and Scripting

Comparing Strings in ksh88

Hi I tried the following string comparison script in Ksh88 #!/bin/ksh str1='aC' str2='ABC' if then echo "Equal" else echo "Not Equal" fi Though str1 and str2 are not equal the script output says Equal . Please correct me Thanks (2 Replies)
Discussion started by: smile689
2 Replies
LOCK_PROFILING(9)					   BSD Kernel Developer's Manual					 LOCK_PROFILING(9)

NAME
LOCK_PROFILING -- kernel lock profiling support SYNOPSIS
options LOCK_PROFILING DESCRIPTION
The LOCK_PROFILING kernel option adds support for measuring and reporting lock use and contention statistics. These statistics are collated by ``acquisition point''. Acquisition points are distinct places in the kernel source code (identified by source file name and line number) where a lock is acquired. For each acquisition point, the following statistics are accumulated: o The longest time the lock was ever continuously held after being acquired at this point. o The total time the lock was held after being acquired at this point. o The total time that threads have spent waiting to acquire the lock. o The total number of non-recursive acquisitions. o The total number of times the lock was already held by another thread when this point was reached, requiring a spin or a sleep. o The total number of times another thread tried to acquire the lock while it was held after having been acquired at this point. In addition, the average hold time and average wait time are derived from the total hold time and total wait time respectively and the number of acquisitions. The LOCK_PROFILING kernel option also adds the following sysctl(8) variables to control and monitor the profiling code: debug.lock.prof.enable Enable or disable the lock profiling code. This defaults to 0 (off). debug.lock.prof.reset Reset the current lock profiling buffers. debug.lock.prof.stats The actual profiling statistics in plain text. The columns are as follows, from left to right: max The longest continuous hold time in microseconds. wait_max The longest continuous wait time in microseconds. total The total (accumulated) hold time in microseconds. wait_total The total (accumulated) wait time in microseconds. count The total number of acquisitions. avg The average hold time in microseconds, derived from the total hold time and the number of acquisitions. wait_avg The average wait time in microseconds, derived from the total wait time and the number of acquisitions. cnt_hold The number of times the lock was held and another thread attempted to acquire the lock. cnt_lock The number of times the lock was already held when this point was reached. name The name of the acquisition point, derived from the source file name and line number, followed by the name of the lock in parentheses. debug.lock.prof.rejected The number of acquisition points that were ignored after the table filled up. debug.lock.prof.skipspin Disable or enable the lock profiling code for the spin locks. This defaults to 0 (do profiling for the spin locks). debug.lock.prof.skipcount Do sampling approximately every N lock acquisitions. SEE ALSO
sysctl(8), mutex(9) HISTORY
Mutex profiling support appeared in FreeBSD 5.0. Generalized lock profiling support appeared in FreeBSD 7.0. AUTHORS
The MUTEX_PROFILING code was written by Eivind Eklund <eivind@FreeBSD.org>, Dag-Erling Smorgrav <des@FreeBSD.org> and Robert Watson <rwatson@FreeBSD.org>. The LOCK_PROFILING code was written by Kip Macy <kmacy@FreeBSD.org>. This manual page was written by Dag-Erling Smorgrav <des@FreeBSD.org>. NOTES
The LOCK_PROFILING option increases the size of struct lock_object, so a kernel built with that option will not work with modules built with- out it. The LOCK_PROFILING option also prevents inlining of the mutex code, which can result in a fairly severe performance penalty. This is, how- ever, not always the case. LOCK_PROFILING can introduce a substantial performance overhead that is easily monitorable using other profiling tools, so combining profiling tools with LOCK_PROFILING is not recommended. Measurements are made and stored in nanoseconds using nanotime(9), (on architectures without a synchronized TSC) but are presented in microseconds. This should still be sufficient for the locks one would be most interested in profiling (those that are held long and/or acquired often). LOCK_PROFILING should generally not be used in combination with other debugging options, as the results may be strongly affected by interac- tions between the features. In particular, LOCK_PROFILING will report higher than normal uma(9) lock contention when run with INVARIANTS due to extra locking that occurs when INVARIANTS is present; likewise, using it in combination with WITNESS will lead to much higher lock hold times and contention in profiling output. BSD
March 7, 2012 BSD
All times are GMT -4. The time now is 10:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy