You can use commands like the following in vi editor:
:%s/^/#/g
or
:%s/^#//g
You can replace % with the range of numbers like
:1,5s/^/#/g
Or can use ., $ for current position and end of file respectively.
Thanks Feherke. This is very valuable information. Even I tried the same queries and had the following results first and last query only I mention (in consistent with yours):
time { C=0; I=1; R=0; while [ $C -lt 1000000 ]; do let R=$R+$I; let C=$C+1; done }
real 0m53.28s
user 0m53.22s
sys...
RodKnowIton,
Can you please look at this code:
[bansah01@:/h/bansalh01/temp]more test.sh
#!/bin/ksh
a=1
while [ "$a" ]
do
echo "-$a- is the value"
read a
done
Execution :
------------
[bansah01@:/h/bansalh01/temp]test.sh
-1- is the value
2
-2- is the value
3
-3- is the value
4
-4- is...
feherke,
I happened to test the difference in time when using expr and using let. I found a huge difference. With the following script:
#!/bin/ksh
#Usage $0 <startcount> <quantity> <incrementby>
NUMARGS=$#
if [ ${NUMARGS} -lt 3 ]
then
echo "Usage $0 <startcount> <quantity> <incrementby>"...
Thanks Feherke, it worked fine.
mrn as per your suggestion I was looking to find out the quantity of suffix. I could not understand your solution but got this one (may be this is what you were referring to):
Size of suffix = log (number, basename)
where
number = (total number of lines in big...
Probably this condition $(($CHECKVALUE = "END")) is not getting satisfied after the first initialization of FILENAME. So the first file is getting created and subsequently no one.
Check 1) if you are assigning to the variable CHECKVALUE correctly (contents of a line) 2) Will the appearance of...
Also as suggested by PHV and feherke, these are the changes I made to the original script:
#!/bin/ksh
NUMOFARGS=$#
if [ $NUMOFARGS -lt 2 ]
then
echo "Invalid usage"
echo "Usage: $0 <FileName> <NumberOfLines>"
exit 1
fi
INPUTFILENAME=$1
NUMBEROFLINES=$2
LINECOUNTER=0
FILECOUNT=1...
Thanks PHV. I could use let for assigning value to a variable. Can I do something about :-
if [ "`expr $LINECOUNTER % $NUMBEROFLINES`" -eq "0" ]
Also, how can I avoid using cat.
I was using split for the purpose but it has a limitation of 676 files. I could not understand how to split a file based on lines numbers using csplit. Can you elaborate. I need a large file to be split into a large number of files containing 2 lines of the larges file. The number of splitted...
You can modify the following script to your needs (you just need to change the end of file indication condition whereby I am using line counts):
#!/bin/ksh
NUMOFARGS=$#
if [ $NUMOFARGS -lt 2 ]
then
echo "Invalid usage"
echo "Usage: $0 <FileName> <NumberOfLines>"
exit 1
fi...
Please tell me a unix command or utility for splitting of a very big text file into small files of say 2 lines each. For now I wrote my own script to do the job but I am looking for some standard command/utility.
Thanks Annihilannic, it was very really good. This script although does not work for searching for count of word. Can you write similar script for a word as well.
Are you aware if there is any unix inbuild command for this purpose.
I need to find the count of a character or a set of characters in a file. Is there a unix command for that?
Like for given file I need to find out number of occurences of "af":
afbcd efg abef akljklj jklj ljlj
ljlkj jflja fjklja j ljkfaj jkj
jljaf jflaj jafj;ajj;jj jlkj;
I want to write shell script which takes some flags along with input parameters. What I mean is like ls which can take input as parameters filename/file directory alongwith flags like -l, -m, -a etc.
ls -latr *.txt
This way I want to write my script as
myscript -w myinput
Also do correct me...
This problem was coming because there was no unique index made on the table. When I made the unique index on the table then the cursor started fetching all the records.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.