10 More Discussions You Might Find Interesting
1. Programming
hi
I want to write a function which takes int as input and returns a string like this.
char GetString(int iNo)
{
switch(iNo)
{
case 0:
return "Zero";
break;
case 1:
return "One";
break;
}
}
void main()
{
int i;
printf("Enter... (1 Reply)
Discussion started by: atharalikhan
1 Replies
2. Shell Programming and Scripting
Hi,
I would like to return the last part of a string in an array of strings in bash.
The array contains in each position the content below:
and I would like to return only the last part of each string.
The correct result would be:
How can I do that in bash using AWK?... (7 Replies)
Discussion started by: anishkumarv
7 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I have a file with the following contents:
I need to create a script or search command that will search for this string 'ENDC' in the file. This string is unique and only occurs in one record. Once it finds the string, I would like it to return positions 101-109 ( this is the date of... (0 Replies)
Discussion started by: Lenora2009
0 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I have a file with the following contents:
COMPANY ABCD
TRUCKER JOE SMITH
TRUCK 456
PLATE A12345678
TRUCKER BILL JONES
TRUCK 789
PLATE B7894561
I need to create a script or search command that will search for this string '789' in the file. This string is unique and only... (7 Replies)
Discussion started by: doza22
7 Replies
5. Shell Programming and Scripting
I have looked at almost every posting on here regarding, grep, sed, awk, nawk, perl methods to perform this function, but they are just not returning the results I hope to see.
Example File:
abcdef
123456
ghijkl
7890123
7890123
7890123
7890123
mnopqrs
456789
This is the most... (4 Replies)
Discussion started by: doza22
4 Replies
6. Shell Programming and Scripting
Hy everybody
I'm trying to write a function like
function(){
final=$1
return $final
}
but I get following error:
"return: bad non-numeric arg ''"
what shall I do? Isn't it possible to return strings?:confused:
thanks
lucae (2 Replies)
Discussion started by: lucae
2 Replies
7. Shell Programming and Scripting
Hi friends
I need to return string value in functions
can anyone help me out to return string values rather than integer.
#!/bin/bash
add_a_user()
{
USER=$1
COMPANY=$2
shift; shift;
echo "Adding user $USER ..."
echo "$USER working in $COMPANY ..."
ret_type=YES
return... (1 Reply)
Discussion started by: kittusri9
1 Replies
8. Shell Programming and Scripting
hi there
I'm getting a string from a sqlplus query, and I need to compare it with another string
Problem here, is that the string i get from query brings a 'carriage return' with it, and comparing throws always false value.
i need to delete all carriage retun charactres in string.
how... (6 Replies)
Discussion started by: viko
6 Replies
9. Shell Programming and Scripting
Dear All
I had below mention file as my input file.
87980457 Jan 12 2008 2:00AM 1 60 BSC1
81164713 Jan 12 2008 3:00AM 1 60 BSC2
78084521 Jan 12 2008 4:00AM 1 60 BSC3
68385193... (3 Replies)
Discussion started by: jaydeep_sadaria
3 Replies
10. Shell Programming and Scripting
Hi there
Does anybody know how to get grep to return the line underneath the string i am grepping for ie, if i have this file
hello
everybody
how
are
you
and i issue #cat file | grep how
I would like it to return the line below (in this case the string "are")
Is this... (2 Replies)
Discussion started by: hcclnoodles
2 Replies