Newbi - Understanding the Code and proper download


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Newbi - Understanding the Code and proper download
# 1  
Old 12-23-2008
Newbi - Understanding the Code and proper download

Hi,
I am new to Unix and there is code that is trying to get data from a location and save it. However it's output is messing up some date fields in the source file (ie... in source is may say 10/10/2008, the code will output 10/10/20088). This is the piece of code. Can someone help to understand what it does and how it can be fixed? Thanks in advance!

#!/bin/ksh
#set final file
REPORT="/sas02/logistics/prom/incoming/LCL_KIT2_RPT.txt"
REPSRV="lcl####.ngco.com"
# using telnet through the http port 80 get the current name of the lcl promo file
REPURL=`(sleep 1; echo "GET /kixprod/cgi-bin/biceps_exec_log.pl?day=0 HTTP/1.0"; echo""; sleep 1) | telnet $REPSRV 80 | sed '/GROCERY.PROMOS/!d; s/.*ngco.com//; s/">.*//'`
#echo $REPURL
[[ -r $REPORT ]] && rm $REPORT
# using telnet through the http port 80 get the LCL_GROCERY_PROMO.txt file
(sleep 1; echo "GET $REPURL HTTP/1.0"; echo "Content-type: text/plain"; echo ""; sleep 60) | telnet $REPSRV 80 | sed "/,/!d; s/<.*>//; s/\&amp;/\&/; s/\&quot;/\q/" > $REPORT
# 2  
Old 12-24-2008
mpinto,

I don't see any date in the piece of code you've provided. If your saying that it is appending the code 10/10/20088. Im recommending that you analyze your script and look for a function or script pertaining to date or appending to a date.

Cheers,
# 3  
Old 12-24-2008
Tools Related to the sed's ?

Can you show complete lines of input and output data?
My 2nd thought (after expecting a date command or obvoius data usage) is that one of the sed commands is duplicating the text.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Understanding bash code

I am not able to understand below line in unix bash shell.Could anyone explain what it will do result="${path1}/*${var1}*${var2}*wssreligibleitem*.csv" path1 is defined and it is a directory path var1 is defined and it holds string value like abc var2 is defined and it holds string value like... (6 Replies)
Discussion started by: vamsi.valiveti
6 Replies

2. Shell Programming and Scripting

[Solved] Help understanding this code!!

Hi guys, I am still learning awk and much apprecated to shed some light on the following: the questions asked is below! { total = i = 0 do { ++i total += $i } while ( total <= 100 ) print i, ":", total } File used: cat test.do 45 25 60 20 10 105 50 40 33 5 9 67 108 3 5 4 (2 Replies)
Discussion started by: Apollo
2 Replies

3. SuSE

Newbi: High availbilty extenstion for SLES 11 on VMware

Hi Guys , Can some one help me out with the basic requirements and steps required to setting up High availabilty extension in SLES11 sp2 on vmware .:) Iam struggling with the basic installation of SLES and finally completed it after a long trilas and it will be helpful if some one do help me... (0 Replies)
Discussion started by: shiek.kaleem
0 Replies

4. Shell Programming and Scripting

Changes in code to provide proper result with one additional fiield

Hi all I am using following code to get results for brand name drug target name and generic name from my attached fiile awk 'k>0 {if (a && k==2) {print a":"a":"a; a=a=a="";} a=a?a","$0:$0; k=0;} /^# Drug_Target_.*_Gene_Name/ {k=3;} /^# Generic/ {k=1;} /^# Brand_Name/ {k=2;} END {if (a)... (1 Reply)
Discussion started by: manigrover
1 Replies

5. Shell Programming and Scripting

Help understanding some Perl code.

Well, I found myself trying to fix some Perl code (Ive never done any Perl in my life) and I pinpointed the place where the bug could be. But to be sure I have to know what does a few line of code mean: $files_lim =~ (/^\d*$/) $files_lim =~ (/^\d*h$/) $files_age =~ s/h// The code where... (2 Replies)
Discussion started by: RedSpyder
2 Replies

6. Shell Programming and Scripting

Help understanding Perl code.

Well, I found myself trying to fix some Perl code (Ive never done any Perl in my life) and I pinpointed the place where the bug could be. But to be sure I have to know what does a few line of code mean: $files_lim =~ (/^\d*$/) $files_lim =~ (/^\d*h$/)$files_age =~ s/h//The code where this was... (0 Replies)
Discussion started by: RedSpyder
0 Replies

7. UNIX Desktop Questions & Answers

Understanding the code

hello all, May i know what is this "DEBUG_ME $DEBUG_CMD main" doing in the below code. I am confused with alias also "alias DEBUG_ME='#'". Thanks for your help. set -x alias DEBUG_ME='#' if ; then . /product/apps/informatica/v7/pc/ExtProc/debug.ksh "$1" fi # Declaring the... (1 Reply)
Discussion started by: Ariean
1 Replies

8. Shell Programming and Scripting

HI Newbi in Unix (spanish)

Mi idea es crear un pequeña shell...lo que pasa es que cuando ejecuto el siguiente programa va todo bien hasta que me salta el error perror("Error al ejecutar la función execvp\n"); Entonces la aplicación me entra en un bucle(repitiendo todo el rato el error anterio), como puedo hacer para que eso no... (1 Reply)
Discussion started by: isnhatar
1 Replies

9. UNIX for Dummies Questions & Answers

Understanding Code in IF LOOP

Hello All, I would like to know and understand the difference between the below 3 IF loops and also if possible what are the different other parameters i could use other than those mentioed in the below lF LOOP conditions, appreciate your help. Thanks, Sam. (1 Reply)
Discussion started by: Ariean
1 Replies

10. UNIX for Dummies Questions & Answers

Little Trouble Understanding some code...

Couple of questions as I try to decipher someones code who left... What would something coded like this do? IFS=: grep FIELD1 /Path/Path2/Param.fle | read LBL1 LBL2 USRID EADR SUBJ SERVERNAME CFGTBL DIR ERR=0 Param.fle contents.. FIELD1:FEI::FIELD2:dATAFIELD BATCH:MAIN SERVER......etc.. (2 Replies)
Discussion started by: NycUnxer
2 Replies
Login or Register to Ask a Question