12-02-2007
i'm not really sure what alot of that stuff means.. i'm new to C++... i don't know what arcg and **argv mean.. also is this just for a paragraph of 256 letters? and why do you assign int i = 32? and i also dont know what return 0 does...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I need to find whether the first character in a line is a alphabet or a number. If its a number i should sort it numerically. If its a alphabet i should sort it based on the ASCII value.And if it is something other than alphabet or number then sort it based on ASCII value.
The code i used... (2 Replies)
Discussion started by: ragavhere
2 Replies
2. UNIX for Dummies Questions & Answers
afternoon forums.
I need to get a way of testing as to wether an inputed character is part of the english alphabet.
i have come up with the following code but its not working at all.
until ']
do
echo This is not a Letter
done
any help would be beneficial to me. (1 Reply)
Discussion started by: strasner
1 Replies
3. Shell Programming and Scripting
I am a newbie in UNIX shell script and seeking help on this UNIX function. Please give me a hand. Thanks.
I have a large file. Named as 'MyFile'. It was tab-delmited. I am told to write a shell function that counts the number of occurrences of the ord “mysring” in the file 'MyFile'. (1 Reply)
Discussion started by: duke0001
1 Replies
4. UNIX for Dummies Questions & Answers
People, I need your help with making a script which will
1. take as an input the number of lines, smth like this:
((RUBROBACTER_1_PE1288
(((SALINISPORA_1_PE1863
SALINISPORA_1_PE1828)100
((NOCARDIOIDES_2_PE2419
PROPIONIBACTERIUM_1_PE1395)96
((((((((CORYNEBACTERIUM_1_PE1119... (3 Replies)
Discussion started by: roussine
3 Replies
5. Shell Programming and Scripting
Hi All,
Is it possible to count number of occurrences of a pattern in a single record using awk??
for example:
a line like this:
abrsjdfhafa
I want to count the number of a character occurrences. but still use the default RS, I don't want to set RS to single character. (1 Reply)
Discussion started by: ghoda2_10
1 Replies
6. Linux
file:///C:/Users/TSHEPI%7E1.LEB/AppData/Local/Temp/moz-screenshot.pngATM@ubuntu:~$ cat numbers2 | sort -n | uniq -c
1
7 1
11 2
10 3
the 1st numbers are the counts from the command "uniq -c", which represent the number of occurrences of each in the file. The "sort -n"... (4 Replies)
Discussion started by: lebogot
4 Replies
7. Shell Programming and Scripting
ok the user can only enter a number if a letter is entered it shouldnt be accepted
This is what i have so far
read -p "How many cars to enter:" cars
until
do
read -p "Invalid number. Please re-enter:" $tags
done (5 Replies)
Discussion started by: gangsta
5 Replies
8. Shell Programming and Scripting
Hi,
I have a file (movies.sh), this file contains list of movies such as
I want to redirect the movies from movies.sh to file_to_process to allow me process the file with out losing anything.
I have tried
Movies.sh >> file_to_process
But I want to add the row number to the data... (2 Replies)
Discussion started by: INHF
2 Replies
9. Shell Programming and Scripting
Hello Friends,
Can somebody assist an issue I am having? I have a separate file with a list of account ids
XXX200B02Y01
XXX200B03Y01
XXX200B05Y01
XXX200B07Y01
XXX200B08Y01
I call the file, and run an egrep against a directory and logfiles
AccountID=$(cat... (2 Replies)
Discussion started by: liketheshell
2 Replies
10. Shell Programming and Scripting
Here is my grep string to print only the last occurrence, with before and after lines. Note that the tail Argument is sum of B and A args + 1, so that it prints the data of only the last 1 match. Now I need to print last 2 such matches. I thought of doubling the tail arg like 5+5+1 (For -- line),... (2 Replies)
Discussion started by: samjna
2 Replies
LEARN ABOUT PLAN9
getflags
GETFLAGS(9.2) GETFLAGS(9.2)
NAME
getflags, usage - process flag arguments in argv
SYNOPSIS
#include <libg.h>
#include <fb.h>
int getflags(int argc, char *argv[], char *flags)
int usage(char *tail)
extern char **flag[], cmdline[], *cmdname, *flagset[];
DESCRIPTION
Getflags digests an argument vector argv, finding flag arguments listed in flags. Flags is a string of flag letters. A letter followed by
a colon and a number is expected to have the given number of parameters. A flag argument starts with `-' and is followed by any number of
flag letters. A flag with one or more parameters must be the last flag in an argument. If any characters follow it, they are the flag's
first parameter. Otherwise the following argument is the first parameter. Subsequent parameters are taken from subsequent arguments.
The global array flag is set to point to an array of parameters for each flag found. Thus, if flag -x was seen, flag['x'] is non-zero, and
flag['x'][i] is the flag's ith parameter. If flag -x has no parameters flag['x']==flagset. Flags not found are marked with a zero. Flags
and their parameters are deleted from argv. Getflags returns the adjusted argument count.
Getflags stops scanning for flags upon encountering a non-flag argument, or the argument --, which is deleted.
Getflags places a pointer to argv[0] in the external variable cmdname. It also concatenates the original members of argv, separated by
spaces, and places the result in the external array cmdline.
Usage constructs a usage message, prints it on the standard error file, and exits with status 1. The command name printed is argv[0].
Appropriate flag usage syntax is generated from flags. As an aid, explanatory information about flag parameters may be included in flags
in square brackets as in the example. Tail is printed at the end of the message. If getflags encountered an error, usage tries to indi-
cate the cause.
EXAMPLES
main(int argc, char *argv[]){
if((argc=getflags(argc, argv, "vinclbhse:1[expr]", 1))==-1)
usage("[file ...]");
}
might print:
Illegal flag -u
Usage: grep [-vinclbhs] [-e expr] [file ...]
SOURCE
/sys/src/libfb/getflags.c
SEE ALSO
ARG(2)
DIAGNOSTICS
Getflags returns -1 on error: a syntax error in flags, setting a flag more than once, setting a flag not mentioned in flags, or running out
of arguments while collecting a flag's parameters.
GETFLAGS(9.2)