Search Results

Search: Posts Made By: mehmet_demirez
8,826
Posted By mehmet_demirez
Consider the following loop. This allows three...
Consider the following loop.
This allows three command line options , one of which accepts an argument(b),
because "b" is followed by a ":" in the getopts arguments.
When processing option b ,...
23,243
Posted By mehmet_demirez
i'm not sure i understood correctly but if you...
i'm not sure i understood correctly but if you want to grep only on the second line, something like this might be helpful:

head -2 data.txt | tail -1 | grep "single"
4,615
Posted By mehmet_demirez
correction for 4) you need a fi for this if: ...
correction for 4)
you need a fi for this if:
if [[ $IsCronJob -ne 1 ]]; then
4,615
Posted By mehmet_demirez
1) ..... a) FilesToDelete="OPTARG" ..... ...
1)
.....
a) FilesToDelete="OPTARG"
.....
Shouldn't it be $OPTARG instead of OPTARG ?

2 ) put a ;; after the "esac" at the end of the second "case"

3) you need a "fi" after this

if [[...
5,827
Posted By mehmet_demirez
ooops i've forgotten the brackets. you're...
ooops i've forgotten the brackets. you're absolutely right
8,265
Posted By mehmet_demirez
try this : find . | xargs grep -l...
try this :

find . | xargs grep -l "test"
5,827
Posted By mehmet_demirez
nawk supports more than one field separator on...
nawk supports more than one field separator on the command line:

nawk -F':+' ....
1,885
Posted By mehmet_demirez
how do you tell that it's looping infinitely. ...
how do you tell that it's looping infinitely.
maybe it's just expecting input because $file is NULL ??
1,764
Posted By mehmet_demirez
an example : ls -ltr | awk '{print $5}' | ...
an example :

ls -ltr | awk '{print $5}' |
while read size
do
echo "size is $size"
done
14,679
Posted By mehmet_demirez
what's an expect script? i don't understand it...
what's an expect script?
i don't understand it but you can check the exit status of any process
by checking $? right after you call the script.
For instance:

expect_script
if [ $? -eq 0 ]
...
3,031
Posted By mehmet_demirez
oh yes , you're right :) i assumed it's a list...
oh yes , you're right :)
i assumed it's a list of strings.
3,031
Posted By mehmet_demirez
first of all not cat $item >> /tmp/output ...
first of all
not cat $item >> /tmp/output
echo $item >> /tmp/output

you can use this to convert the list to lines and insert into file at once:
echo $LIST | awk '{for (i=1; i<=NF; ++i) {print...
6,101
Posted By mehmet_demirez
Use exit with an exit code to indicate success or...
Use exit with an exit code to indicate success or failure
0 : success
anything but 0 : failure
1,813
Posted By mehmet_demirez
or PID of the shell script if used in a shell...
or PID of the shell script if used in a shell script.
can be used to create unique temp files :
ex:
touch temp_$$
4,275
Posted By mehmet_demirez
just to understand the problem: what if ...
just to understand the problem:
what if

file1
-------
a
b
c
f
g
h

file2
---------
a
b
d
e
f
h
5,930
Posted By mehmet_demirez
this is my solution : isn't it wonderful that...
this is my solution :
isn't it wonderful that you can have more than one solution in Unix :)


#$1 : file

IFS=:

grep -n "Error:" $1 |
while read line_no the_rest
do
head...
5,004
Posted By mehmet_demirez
extending previous solution for subfolders: ...
extending previous solution for subfolders:

for file in `find .`
do
mv $file `echo $file | sed 's/:/_/g'`
done
4,761
Posted By mehmet_demirez
I don't understand why you think it does not give...
I don't understand why you think it does not give you the file name.
It should work fine as well as the below code.
4,363
Posted By mehmet_demirez
If you wish to iterate on the contents of the...
If you wish to iterate on the contents of the current directory , you don't need to assign a variable the contents of the current directory.The For loop can operate using Unix file name expansion:
...
3,931
Posted By mehmet_demirez
If I get you right , you want something like this...
If I get you right , you want something like this :

if [[ -n $str1 ]] ; then
echo "TRUE"
else
echo "FALSE"
fi
4,666
Posted By mehmet_demirez
1) I don't think there exists such a...
1) I don't think there exists such a utility.There may be experimental utilities , though.
2) A google lookup will get you hundreds of web pages like for instance : Unix Utilities - ticalc.org...
Forum: Open Source 12-22-2007
338,958
Posted By mehmet_demirez
Back on university days , I used pico.But...
Back on university days , I used pico.But currently I use mostly emacs for programming and vim for text editing.
Showing results 1 to 22 of 22

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