Question:
Linux Shell scripting problem ?
nini
2011-04-05 00:45:01 UTC
Guys can anyone give me the code of following problem? It is really very urgent..

Write a shell script in Unix/Linux to find the lines numbers of a text file are having word which is 5 to 10 characters long and having first letter as a capital letter.
Three answers:
2011-04-07 04:44:36 UTC
You want to loop through the file (Google it) check if it matches a regex ( [A-Z].{4,} would work ) and increment a counter for every regex match.
?
2016-11-06 11:57:06 UTC
i don't think of it truly is achieved. What you may attempt nonetheless, is employing 'anticipate'. this may well be a equipment for the Tcl/Tk language. It facilitates you to're making scripts to talk with interactive classes (like su), that takes one in each and every of those particular queries from a software (like "Password:") being responded to via particular responses (like the password retrieved from a record). the completed variety of the Tcl language (like if, for, at the same time as) is attainable to you, and it is likewise attainable to flee from the script and permit the consumer take over (e.g after sucessfully logging in). The command 'autoexpect' it is secure in the equipment; "information" the consumer's interplay with a software, for this reason easely development a skeleton for an anticipate-script for use with this methodology.
laxmanvelprajesh
2011-04-06 21:18:36 UTC
use the below command

cat -n filename



or search with grep you will get the line number of the file


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...