Search Results

Search: Posts Made By: lorcan
54,130
Posted By lorcan
I think there should be an issue with the sed...
I think there should be an issue with the sed command in the line which is added new, so remove the sed part.

And check if that for loop is getting the correct line from the input file by printing...
54,130
Posted By lorcan
You can just create a variable and accumulate the...
You can just create a variable and accumulate the count_fields in the script until it is the 6th line of the file. And check if that is equal to 90.
54,130
Posted By lorcan
sort your_file | uniq -d You can just...
sort your_file | uniq -d


You can just add these lines instead of the existing for loop in the script

sort $inpFile | uniq -d | sed "s/$/& : Duplicate/g" >> $errFile
for line in $(cat...
54,130
Posted By lorcan
Try the code again, i have added an else part so...
Try the code again, i have added an else part so that it the lines that are more than 27 entries are also redirected to error file
54,130
Posted By lorcan
Script #!/bin/ksh inpFile=$1 ...
Script

#!/bin/ksh

inpFile=$1
outFile="$HOME/Output.txt"
errFile="$HOME/Error.txt"
tmpFile1="/tmp/sample1.txt"
tmpFile2="/tmp/sample2.txt"
sortFile="/tmp/sortfile.txt"

TOTAL_FILEDS=9...
54,130
Posted By lorcan
I am using an Linux server, so might be due to...
I am using an Linux server, so might be due to this there is a difference.
But anyway.

1. What is the output of

echo...
54,130
Posted By lorcan
Post the script output of the script when run as...
Post the script output of the script when run as a debug mode, like

ksh -x newfinalscript testingdata

+ inpFile=input2
+ outFile=/home/Output.txt
+ tmpFile1=/tmp/sample1.txt
+...
54,130
Posted By lorcan
It is not throwing me any error. I have added...
It is not throwing me any error. I have added this line to the file and the script works fine

$ >ksh nam.ksh input2...
54,130
Posted By lorcan
Modified script
#!/bin/ksh

inpFile=$1
outFile="$HOME/Output.txt"

tmpFile1="/tmp/sample1.txt"
tmpFile2="/tmp/sample2.txt"
sortFile="/tmp/sortfile.txt"

TOTAL_FILEDS=9
COUNT=1
rm -f $outFile

for line...
54,130
Posted By lorcan
Perdarabo has hardcoded the input file as...
Perdarabo has hardcoded the input file as data(3rd line) in the code, So copy your input file as data and then try this script.
54,130
Posted By lorcan
Script
Check if this works

#!/bin/ksh

inpFile=$1
outFile="$HOME/Output.txt"

tmpFile1="/tmp/sample1.txt"
tmpFile2="/tmp/sample2.txt"
sortFile="/tmp/sortfile.txt"
TOTAL_FILEDS=9
COUNT=1
rm -f...
54,130
Posted By lorcan
Namish- As per your requirement the first...
Namish-

As per your requirement the first column of your input file is not in ascending order due to which the script is throwing an error

00
02
00
00
06
00
00
00
05
00
04
01
06
54,130
Posted By lorcan
This script checks for the 15 tickets in a row...
This script checks for the 15 tickets in a row and also checks if there are 5 tickets within every 9 columns.

And as a whole i am checking whether there are atleast one ticket in a column and...
54,130
Posted By lorcan
For this req i had written the script. For other...
For this req i had written the script. For other it was already complete right. I hope you use two input files one with 9 entries and other as mentioned above
54,130
Posted By lorcan
When i checked the count of fields with your...
When i checked the count of fields with your input it gives 15.
Check below

echo "02 00 00 34 41 00 00 70 81" | sed "s/ /,/g;s/00,*//g;s/,$//g" | wc -c
54,130
Posted By lorcan
Might be the output file is not created based on...
Might be the output file is not created based on the condition in the if loop.
Can you run the script in debug mode
54,130
Posted By lorcan
Havent tested it, You can give a try ...
Havent tested it, You can give a try

#!/bin/ksh

inpFile=$1
outFile="$HOME/Output.txt"

modFile="/tmp/mod_inputfile.txt"
tmpFile1="/tmp/sample1.txt"
tmpFile2="/tmp/sample2.txt"
...
54,130
Posted By lorcan
i could get only the requirement 3 This code...
i could get only the requirement 3

This code prints the lines if there are 15 fields ignoring the fillers "00"

#!/bin/ksh

inpFile=$1

for line in `cat $inpFile`
do
...
54,130
Posted By lorcan
I think you have opened mutiple threads for this...
I think you have opened mutiple threads for this which is against the forum rules.
Showing results 1 to 19 of 19

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