Sponsored Content
Top Forums Shell Programming and Scripting Finding longest common substring among filenames Post 302267603 by cfajohnson on Friday 12th of December 2008 07:41:55 PM
Old 12-12-2008
Code:
set -- *
files=$#
name=$1
while [ -n "$name" ]
do
  set -- $name*
  [ $# -eq $files ] && break
  name=${name%?}
done
echo $name

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

finding the last substring...

hii, i want to know the shell command for finding the last occurance of a substring in string.. i can use grep command or sed to find out the occurance of a substring in a string but how do i find out the last occurance.shud i use grep amd and cut the string everytime and store it in a new... (7 Replies)
Discussion started by: cutelucks
7 Replies

2. Shell Programming and Scripting

Finding the most common entry in a column

Hi, I have a file with 3 columns in it that are comma separated and it has about 5000 lines. What I want to do is find the most common value in column 3 using awk or a shell script or whatever works! I'm totally stuck on how to do this. e.g. value1,value2,bob value1,value2,bob... (12 Replies)
Discussion started by: Donkey25
12 Replies

3. Shell Programming and Scripting

Finding duplicates from positioned substring across lines

I have million's of records each containing exactly 50 characters and have to check the uniqueness of 4 character substring of 50 character (postion known prior) and report if any duplicates are found. Eg. data... AAAA00000000000000XXXX0000 0000000000... upto50 chars... (2 Replies)
Discussion started by: gapprasath
2 Replies

4. Shell Programming and Scripting

Finding longest line in a Record

Good Morning/Afternoon All, I am using the nawk utility in korn shell to find the longest field and display that result. My Data is as follows: The cat ran The elephant ran Milly ran too We all ran I have tried nawk '{ if (length($1) > len) len=length($1); print $1}' filename The... (5 Replies)
Discussion started by: SEinT
5 Replies

5. Shell Programming and Scripting

Finding the length of the longest column

Hi, I am trying to figure out how to get the length of the longest column in the entire file (because the length varies from one row to the other) I was doing this at first to check how many fields I have for the first row: awk '{print NF; exit}' file Now, I can do this: awk '{ if... (4 Replies)
Discussion started by: MIA651
4 Replies

6. Shell Programming and Scripting

Finding most common substrings

Hello, I would like to know what is the three most abundant substrings of length 6 from col2. The file is quite large and looks like this col1 col2 EN03 typehellobyedogcatcatdog EN09 typehellobyebyebyebye EN08 dogcatcatdogbyebyebyebye EN09 catcattypehellobyebyebyebye... (9 Replies)
Discussion started by: verse123
9 Replies

7. Shell Programming and Scripting

Parsing the longest match substring

Hello gurus, I have a database of possible primary signal strings pp22 pt22dx pp22dx jty2234 Also I have a list of scrambled signals which has a shorter string and a longer string separated by // (double slash ). Always the shorter string of a scrambled signal will have the primary... (6 Replies)
Discussion started by: senhia83
6 Replies

8. UNIX for Beginners Questions & Answers

Finding common entries between 10 columns

Hello, I need to find the intersection across 10 columns. Kindly help. my file (INPUT.csv) looks like this 4_R 4_S 8_R 8_S 12_R 12_S 24_R 24_S LOC_Os01g01010 LOC_Os01g01010 LOC_Os01g01010 LOC_Os04g48290 LOC_Os01g01010 LOC_Os01g01010... (1 Reply)
Discussion started by: Sanchari
1 Replies

9. UNIX for Beginners Questions & Answers

Finding a word through substring in a file

I have a text file that has some data like: PADHOGOA1 IOP055_VINREG5_1 ( .IO(VINREG5_1), .MONI(), .MON_D(px_IOP055_VINREG5_1_MON_D), .R0T(px_IOP054_VINREG5_0_R0T), .IO1() ); PADV30MA0 IOP056_VOUT3_IN ( .IO(VOUT3_IN), .V30M(px_IOP056_VOUT3_IN_V30M)); PADV30MA0 IOP057_VOUT3_OUT (... (2 Replies)
Discussion started by: utkarshkhanna44
2 Replies

10. UNIX for Beginners Questions & Answers

Replace substring by longest string in common field (awk)

Hi, Let's say I have a pipe-separated input like so: name_10|A|BCCC|cat_1 name_11|B|DE|cat_2 name_10|A|BC|cat_3 name_11|B|DEEEEEE|cat_4 Using awk, for records with common field 2, I am trying to replace all the shortest substrings by the longest string in field 3. In order to get the... (5 Replies)
Discussion started by: beca123456
5 Replies
MAN(7)							 Miscellaneous Information Manual						    MAN(7)

NAME
man - macros to typeset manual SYNOPSIS
nroff -man file ... troff -man file ... DESCRIPTION
These macros are used to lay out pages of this manual. A skeleton page may be found in the file /usr/man/man.template. Any text argument t may be zero to six words. Quotes may be used to include blanks in a `word'. If text is empty, special treatment is applied to the next input line with text to be printed. In this way .I may be used to italicize a whole line, or .SM may be followed by .B to make small bold letters. A prevailing indent distance is remembered between successive indented paragraphs, and is reset to default value upon reaching a non- indented paragraph. Default units for indents i are ens. Type font and size are reset to default values before each paragraph, and after processing font and size setting macros. These strings are predefined by -man: *R `(Reg)', trademark symbol in troff. *S Change to default type size. FILES
/usr/share/tmac/tmac.an /usr/man/man.template SEE ALSO
troff(1), man(1) BUGS
Relative indents don't nest. REQUESTS
Request Cause If no Explanation Break Argument .B t no t=n.t.l.*Text t is bold. .BI t no t=n.t.l. Join words of t alternating bold and italic. .BR t no t=n.t.l. Join words of t alternating bold and Roman. .DT no .5i 1i...Restore default tabs. .HP i yes i=p.i.* Set pre- vailing indent to i. Begin paragraph with hanging indent. .I t no t=n.t.l. Text t is italic. .IB t no t=n.t.l. Join words of t alternating italic and bold. .IP x i yes x="" Same as .TP with tag x. .IR t no t=n.t.l. Join words of t alternating italic and Roman. .LP yes - Same as .PP. .PD d no d=.4v Interparagraph distance is d. .PP yes - Begin paragraph. Set prevailing indent to .5i. .RE yes - End of relative indent. Set prevailing indent to amount of starting .RS. .RB t no t=n.t.l. Join words of t alternating Roman and bold. .RI t no t=n.t.l. Join words of t alternating Roman and italic. .RS i yes i=p.i. Start relative indent, move left margin in distance i. Set prevailing indent to .5i for nested indents. .SH t yes t=n.t.l. Subhead. .SM t no t=n.t.l. Text t is small. .TH n c x v m yes -Begin page named n of chapter c; x is extra commentary, e.g. `local', for page foot center; v alters page foot left, e.g. `4th Berkeley Distribution'; m alters page head center, e.g. `Brand X Programmer's Manual'. Set prevailing indent and tabs to .5i. .TP i yes i=p.i. Set prevailing indent to i. Begin indented paragraph with hanging tag given by next text line. If tag doesn't fit, place it on separate line. * n.t.l. = next text line; p.i. = prevailing indent 7th Edition October 22, 1996 MAN(7)
All times are GMT -4. The time now is 05:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy