Hi I am using a cut command in the script which is slowing down the performance of the script .can anyone suggest the other ways of doing the same cut command
Record_Type=`echo "$line" | cut -c19-20`
*******this is slowing down*********
i have 4 more cut commands
2 in one loop and 2 in inner looop
can I replace cut with anyother functionalities
Do help me on this thanks
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
It looks like you are processing one line at time. That will be inherently slow, because you will be loading cut for each line. Let cut process the entire file -- try to re-think your method on a file-based idea, preferably with a pipe, or, at the very least, writing an intermediate file like:
then process the scratch file ... cheers, drl
Hi I am using a cut command in the script which is slowing down the performance of the script .can anyone suggest the other ways of doing the same cut command
Record_Type=`echo "$line" | cut -c19-20`
*******this is slowing down*********
i have 4 more cut commands
2 in one loop and 2 in inner looop
can I replace cut with anyother functionalities
Do help me on this thanks
if possible post here, sample input and output - it would be much easier for us to provide alternate solutions
I am using : << cut / cut to comment out block of code.
Works fine on few lines of script, then it gives me this cryptic error when I try to comment out about 80 lines.
The "warning " is at last line of script.
done < results
169 echo "END read all positioning parameters"
170... (8 Replies)
I'm a complete beginner in UNIX (and not a computer science student either), just undergoing a tutoring course. Trying to replicate the instructions on my own I directed output of the ls listing command (lists all files of my home directory ) to My_dir.tsv file (see the screenshot) to make use of... (9 Replies)
Hi
Can anyone what I am doing wrong while using cut command.
for f in *.log
do
logfilename=$f
Log "Log file Name: $logfilename"
logfile1=`basename $logfilename .log`
flength=${#logfile1}
Log "file length $flength"
from_length=$(($flength - 15))
Log "from... (2 Replies)
Hi,
I have a script that, basically, has two input files of this type:
file1
key1=value1_1_1
key2=value1_2_1
key4=value1_4_1
...
file2
key2=value2_2_1
key2=value2_2_2
key3=value2_3_1
key4=value2_4_1
...
My files are 10k lines big each (approx).
The keys are strings that don't... (7 Replies)
Dear All,
I am using the following script to find and replace the date format in a file. The field18 in the file has the following format: "01/26/2010 11:55:14 GMT+04:00" which I want to convert into the following format "20100126115514" for this purpose I am using the following lines of codes:... (5 Replies)