Search Results

Search: Posts Made By: sendhilmani123
5,580
Posted By sendhilmani123
Parsing a file in Shell Script
Hi,

I have a requirement. I have an application which can take a file as inputs. Now the file can contain any number of lines. The tool has to pick up the first uncommented line and begin...
1,588
Posted By sendhilmani123
Checking for spaces or pipes '|'
Hi,

I need to check format if input file. My input file has 4 fields. They should be seperated by a '|' or space. If not I have to throw an error. I have a script(which is not a generic one) to...
2,447
Posted By sendhilmani123
Shell scripting basic doubt
Hi,
I have a script called sam.sh which consists of a single echo statement like this

#/usr/bin/ksh
echo "Mani"

I changed the mode for the script by giving chmod a+x sam.sh.

If I want to...
1,985
Posted By sendhilmani123
Hi, Sorry for the late reply. It worked when I...
Hi, Sorry for the late reply. It worked when I passed the parameters to the function. Thanks.
1,985
Posted By sendhilmani123
Hi, It worked. But the only thing is that when...
Hi,
It worked. But the only thing is that when I put the same code in a function it doesnt work. It says test argument expected in the line where i check for the existence of the file

v=$1
if [...
1,985
Posted By sendhilmani123
Vaildation of command line inputs
Hi,

I want to do the following validations in my script when my script gets 2 parameters as command line inputs.

My script expects 2 inputs : a -f option and a filename

If a filename is...
3,914
Posted By sendhilmani123
Hi, How will I check whether the first line...
Hi,

How will I check whether the first line is starting with a "|" or not. That is if the input file is like this:
|MANI124 45

I shud give it as an error. Basically I shoud check if the line...
3,914
Posted By sendhilmani123
Hi, Thanks. It worked
Hi,

Thanks. It worked
3,914
Posted By sendhilmani123
Removing a particular line from a text file
Hi,
I have a file called inp.txt
the contents of the file are as follows

MANI123|23|41
MANI123|96|23

I want to reove the first line of this file. How can I do it.

Thanks in advance
2,631
Posted By sendhilmani123
Hi, The real problem is that the user may give...
Hi,
The real problem is that the user may give 3 fields or 4 fields in the input file. I shoud perform a check based on that. Thats where I am stuck. Since the number of fields may vary(3 or 4). How...
2,631
Posted By sendhilmani123
Hi, Thanks. It worked. How can I do it if my...
Hi,
Thanks. It worked. How can I do it if my input file has 4 fields and they are seperated by "|". Will the same logic work. I tried it. It didnt work.

Thanks in advance
2,631
Posted By sendhilmani123
Regarding checking the file format
Hi,
This with reference to my earlier thread.

I have file called input that has 2 values. Now I have to check whether the 2 fileds are seperated by a "|" or not. I am not able to do this with the...
4,288
Posted By sendhilmani123
Command line inputs validation
Hi,
I have a script called read.sh that takes a file as input. Now I want to make that script take the file as input with a -f option preceding the filename. How can I do this validation. How can I...
3,312
Posted By sendhilmani123
Hi, With the earlier script that I had...
Hi,

With the earlier script that I had given, its not working when I introduce a fourth field and seperator between third and fourth field is a space and not a "|". Where could I be going wrong.
...
3,312
Posted By sendhilmani123
Hi, I modified the code like this, when my...
Hi,
I modified the code like this, when my input file has four fields.

cnt=0
while read line
do
cnt=`expr $cnt + 1`
first=`echo $line | cut -f1...
3,312
Posted By sendhilmani123
Hi, Sorry. It was my mistake. Instead of giving...
Hi,
Sorry. It was my mistake. Instead of giving field f4 I was giving only f3.

I corrected it and it worked.
3,312
Posted By sendhilmani123
Hi, Now I want to do the same for , when I...
Hi,

Now I want to do the same for , when I have four fields in my input file. When I tried to introduse a variable fourth and do the same thing it didnt work.

This is the script that worked for...
1,883
Posted By sendhilmani123
Validating inputs from a file
Hi,

I have a file called inputs. Now that file has the values like this:
1 2 3

Now In my script called 'get.sh' I do this :
exec < inputs
read a b c d

Now I know that there will not be...
3,312
Posted By sendhilmani123
Hi, Thanks it worked.
Hi,

Thanks it worked.
3,312
Posted By sendhilmani123
Hi, The script is working fine for the...
Hi,
The script is working fine for the following inputs:

Mani|123|proff
Mani 123|proff
Mani|123 proff

But when I just give '|||' in the input file it still tells me that its 'good'. Even...
3,312
Posted By sendhilmani123
Hi, The script works fine when there are no "|"...
Hi,
The script works fine when there are no "|" symbols in the file. But even if one of them is present then it still says that the format is ok, which is not the exact way.
ie....
I have inputs...
3,312
Posted By sendhilmani123
Checking the format of inputs in a file
Hi,

I have a script that takes the contents of another file as inputs. Its assumed that there are 3 values in the input file that are seperated by '|'. I have to check in my script, whether the...
3,246
Posted By sendhilmani123
checking for permissions of a file
Hi,
I have a script called check.sh. I have to pass a file as input to this script. How can I validat whether the file has read permissions or not within the script.

Thanks in advance
33,171
Posted By sendhilmani123
Catching ctrl-C or ctrl-D
Hi there,
I'm using HP-UX 11 machine. I am running a script, thats gonna take a long time to execute. When I press ctrl-c to come out of my script, I have to catch that signal(ctrl-c) and display...
1,558
Posted By sendhilmani123
Removing certain fields from a file
Hi,
I have a file namely 'inputs' The values inside the file are like this and seperated by a '|'.

mani|21|CSE

How can I extract the values from this file without the '|' symbol.

Thanks in...
Showing results 1 to 25 of 32

 
All times are GMT -4. The time now is 07:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy