Search Results

Search: Posts Made By: penfold
3,546
Posted By penfold
This works great - thanks What I need to do...
This works great - thanks

What I need to do is to be able to echo 'DATE incorrect' if it is not 8 digits long or 'DATE correct' if it is..any ideas how to do this..

many thanks
3,546
Posted By penfold
#!/bin/sh date1=01234567 echo $date1 ...
#!/bin/sh

date1=01234567

echo $date1

echo $DATE | sed -n -e '/^[0-9]\{8\}$/p'

>> this produces the following

01234567
./check.sh: /: cannot execute
./check.sh: [0-9]{8}$/p: not found...
3,546
Posted By penfold
clarification
Just to clarify my previous post - is there any function within UNIX that would allow me to check if something is 8 digits long etc. apart from grep
4,401
Posted By penfold
This works
#!/bin/sh

L=0

test()
{
while read line
do

l='expr $L + 1'
echo $L

done

echo $L
}

test < test.sh
3,546
Posted By penfold
Checking variables
Firstly - aplogies to Vino

I need to check wether or not a variable called DATE is actually a date by doing the following - checking it is all numeric and secondly checking if it is 8 digits long....
1,931
Posted By penfold
RegExp question
Hi guys,

does anyone know how to test for a regular expression - i want to include it in a script to make sure the variable is a regexp

cheers
4,401
Posted By penfold
#!/bin/sh L=0 while read line do ...
#!/bin/sh

L=0

while read line
do

L=`expr $L + 1`
echo $L

done < dinseh.sql

echo $L
4,401
Posted By penfold
This still produces 0
This still produces 0
1
2,453
Posted By penfold
regexp
Hi guys,

does anyone know how to test for a regular expression - i want to include it in a script to make sure the variable is a regexp

cheers
4,401
Posted By penfold
Hi, This produces an error: L=$((L+1)) ...
Hi,

This produces an error: L=$((L+1))


also i only mixed up the 1's and L's when copying it onto the forum

cheers
4,401
Posted By penfold
Variable setting help please
L=0

cat test.sh | while read line
do

L='expr $1 + 1'
echo $L

done

echo $l


>>> the echo $L at the end produces 0 but i actually want it to produce the number of lines - any idea why...
3,134
Posted By penfold
Query
Could anyone please explain what the 2a3 is for below?

Is there anyway to just get the differences without the 2a3 and 4,5d4


Thanks
3,134
Posted By penfold
Compare two files
Hi,

I've got two files A and B

File A: File B:

1;2;a;4;5 1;2;1;a;4;7
3;2;b;d;s 3;3;1;b;5;1
e;2;c;s;w l;8;4;d;5;s
4;3;f;w;q ...
1,849
Posted By penfold
Awk Help
Hi,

I have a file as follows:

4047241;20050201;999;12345
5642154;20050202;123;56456

What I need to do is to take each of the fields (delimited by ";") and return the following

...
5,896
Posted By penfold
File Locking
Hi,

Does anyone know what happens when two processes are simultaneously trying to write to a single file in UNIX (AIX)?

Cheers
2,828
Posted By penfold
This is the format of output.txt: ...
This is the format of output.txt:

COEC2372323|EC2372323|7128778| |BE0117013319|381666|180617

and this is the format of assets.dat
...
2,828
Posted By penfold
Is that because of the FNR statement? What I...
Is that because of the FNR statement?

What I need to do is compare two files, third field of the first file (field seperator "|") and the 2nd field of the second file (field seperator ";")
...
2,828
Posted By penfold
:confused: Thanks for your response - sorry...
:confused:

Thanks for your response - sorry yes I meant the record seperator, from reading the man pages i'm aware you can change it within an awk statement - its just that I can't find examples...
2,828
Posted By penfold
AWK help please
Hi,

I have two files each with different record seperators, one with a pipe | and the other with a semi-colon ;

How do you deal with this in awk?

Any help appreciated

specifically i need...
1,358
Posted By penfold
Awk Help
Hi,

I've been given the statement below which I understand, apart from the section {arr[$3]=1;next} - if anyone can shed any light on this that would be great

awk -F\;...
2,790
Posted By penfold
Clarification...
I am only asking about this part of the AWK statement:

arr[$3]=1;next

cheers
2,790
Posted By penfold
AWK explanation
Hi,

Could anyone please explain why we have arr[$3]=1 - what does this statement do?

awk -F\; 'FNR==NR{arr[$3]=1;next};$3 in arr' core.txt gmrd.txt

Any help appreciated
4,635
Posted By penfold
Thanks Ygor
Those links were very useful, Could anyone tell me why we set FNR=NR
I know what they mean, I just can't see why this would be done

Cheers
4,635
Posted By penfold
Can anyon help with this?
Is anyone able to explain what vgersh99 has done above? I'm new to scripting and am finding it immensly difficult trying to figure out what the following statement does exactly:

awk '
BEGIN {...
2,416
Posted By penfold
quick question
does anyone know what $? means? i echoed it on my box (running AIX Korn shell) and got 127
Showing results 1 to 25 of 48

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