I would like to know if there is a command faster then sed, or a way to optimize my code...
Here is the description of my problem:
I have a file "file1" that is composed of 10 columns. The first one contain a list of ID, the second a list of number associated to the firs list of ID. The third one contains ID and the fourth the number associated, etc...
So I have:
The total number of ID is around 8000.
I want to find all the ID starting by a given string (eg. "460...") and extract the associated number. To do that I am simply using a grep command associated with cut and it is going pretty well.
Then I am doing an operation on the numbers extracted (MATLAB) and then I need to put the new values back in place in the file with 10 columns. To do that I am using:
Where "newval" is the list of the new values computed, "listID" is the list of all the ID for which I need to change the associated number and "file1" is hte file with the 10 columns.
This code is working perfectly, but because I have a bunch of ID to change the repeted use of sed is taking A LOT of time (among 8000 ID I need to change about 500).
Yes.
Got few suggestions.
- How about minifying resources
- mod_expires
- Service workers setup
https://www.unix.com/attachments/web-programming/7709d1550557731-sneak-preview-new-unix-com-usercp-vuejs-demo-screenshot-png (8 Replies)
Hi,
I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :-
./sample.sh: line... (12 Replies)
Can this awk statement be optimized? i ask because log.txt is a giant file with several hundred thousands of lines of records.
myscript.sh:
while read line
do
searchterm="${1}"
datecurr=$(date +%s)
file=$(awk 'BEGIN{split(ARGV,var,",");print var}' $line)
... (3 Replies)
Hi,
I have two files in the format listed below. I need to find out all values from field 12 to field 20 present in file 2 and list them in file3(format as file2)
File1 :
FEIN,CHRISTA... (2 Replies)
Okay, title is kind of confusion, but basically, I have a lot of scripts on a server that I need to replace a ps command, however, the new ps command I'm trying to replace the current one with pipes to sed at one point. So now I am attempting to create another script that replaces that line.
... (1 Reply)
Hi forum,
I'm administrating a workstation/server for my lab and I was wondering how to optimize OSX. I was wondering what unnecessary background tasks I could kick off the system so I free up as much memory and cpu power.
Other optimization tips are also welcome (HD parameters, memory... (2 Replies)
Hi All,
My first thread to this sub-forum and first thread of this sub-forum :)
Here it is,
Am trying to delete duplicates from a table retaining just 1 duplicate value out of the duplicate records
for example : from n records of a table out of which x are duplicates, I want to remove x... (15 Replies)
How would one go about optimizing this current .sh program so it works at a more minimal time. Such as is there a better way to count what I need than what I have done or better way to match patterns in the file? Thanks,
#declare variables to be used.
help=-1
count=0
JanCount=0
FebCount=0... (3 Replies)
I have some questions regarding disk perfomance, and what I can do to make it just a little (or much :)) more faster.
From what I've heard the first partitions will be faster than the later ones because tracks at the outer edges of a hard drive platter simply moves faster. But I've also read in... (4 Replies)