Search Results

Search: Posts Made By: emily
1,273
Posted By featheredfrog
Why use the AWK, which, BTW, is a terrific...
Why use the AWK, which, BTW, is a terrific language? It does have some overhead/startup costs. I just pegged myself as a 300Mhz P3 user, didn't I? :)
$ ls -l *.root
-rw-rw-r-- 1 mhofer mhofer 0...
1,273
Posted By RudiC
Use printf with an adequate format string in lieu...
Use printf with an adequate format string in lieu of print (which has an implied <new line>).
1,273
Posted By RudiC
Yes, its because you overwrite the output file...
Yes, its because you overwrite the output file with > instead of appending to it with >> redirection operator.

But - why do you chip the "extension" off the file name when it is part of the...
1,682
Posted By bakunin
I suppose the problem comes from a...
I suppose the problem comes from a misunderstanding about what is done when in the shells evaluation process.

When you write a process substitution in a here-document:

while read line ; do
...
1,682
Posted By Scrutinizer
You're welcome... From man bash: So...
You're welcome...

From man bash:

So everything inside the here document is standard input to the cat command (not commands that are executed)

Since EOF is unquoted:
1,682
Posted By Scrutinizer
I had edited the post in the mean time, have a...
I had edited the post in the mean time, have a look..
1,682
Posted By Scrutinizer
Yes but you will need to assign the value to the...
Yes but you will need to assign the value to the Index variable outside the here document. You cannot assign a value to a variable inside...

--
An alternative is to escape the $ sign inside the...
1,905
Posted By Scrutinizer
How about: filenoext=${FILE%.*} ...
How about:
filenoext=${FILE%.*}
Temp=${filenoext#InputFile}

--
with awk:
echo "$FILE" | awk '{split($0, F, /InputFile|\./); print F[2]}'
or
echo "$FILE" | awk -F 'InputFile|[.]' '{print $2}'
1,905
Posted By RavinderSingh13
Hello emily, You could try following...
Hello emily,

You could try following command and let us know if this helps.

echo $FILE | awk '{match($0,/\_.*\_/);print substr($0,RSTART,RLENGTH+1)}'


Thanks,
R. Singh
3,994
Posted By RavinderSingh13
Hello emily, Not sure about your complete...
Hello emily,

Not sure about your complete requirement, could you please try following and let me know if this helps.

echo $3 | awk '{FILENAME=$3"_"int((NR-1)/200)".txt";print >> FILENAME}'

...
3,994
Posted By Don Cragun
The awk variable FILENAME is provided by awk and...
The awk variable FILENAME is provided by awk and contains the name of the input file that is currently being processed. Redefining it is not a good idea. Try something like this instead:
awk...
3,994
Posted By RudiC
In awk, FILENAME is only defined after the first...
In awk, FILENAME is only defined after the first file has been opened, which is after the BEGIN section has been finished. Within the BEGIN section FILENAME is empty.
3,994
Posted By Don Cragun
Sorry. My mistake. FILENAME isn't defined yet...
Sorry. My mistake. FILENAME isn't defined yet in the BEGIN clause...

Change:
BEGIN {outfile = sprintf("%s_%01d.txt", FILENAME, 0)to:
NR==1 {outfile = sprintf("%s_%01d.txt",...
3,994
Posted By gandolf989
There seems to be a magic awk command for almost...
There seems to be a magic awk command for almost every problem.

---------- Post updated at 12:46 PM ---------- Previous update was at 12:44 PM ----------



csplit might be a far better tool,...
3,994
Posted By RavinderSingh13
Hello emily/gandolf989, If we need to split...
Hello emily/gandolf989,

If we need to split a file according to lines let's say 10'000 lines per file then following may help.

awk '{FILENAME="file"int((NR-1)/10000);print >> FILENAME}'...
3,994
Posted By rbatte1
Well, gandolf989, that appears to be a poor...
Well, gandolf989, that appears to be a poor suggestion given that split will do this all in a single operation. You are wasting IO and CPU resources so it will be quite slow. Also, how would you...
3,994
Posted By gandolf989
If each entry is a line and you want 10,000 lines...
If each entry is a line and you want 10,000 lines try using the
head and tail commands to chop up the file in 10,000 line chunks.
You can probably put it in a for loop with the wc command to see ...
3,994
Posted By RudiC
man split. Did you consider the hints at the...
man split.
Did you consider the hints at the lower page border?
2,577
Posted By RavinderSingh13
Hello emily, Could you please try following...
Hello emily,

Could you please try following code and let me know if this helps.

awk -vs="'" -vs1="infile=[" -vs2="]" -vs3="infile.append(" -vs4=")" '(NR==1){print s1 s $2 s s2} (NR>1){print s3...
3,221
Posted By Scrutinizer
You did not adjust the code? The same line seems...
You did not adjust the code? The same line seems to be used.

Another thing I noticed is that on this line:
crab -status -c $SAMPLE >& $SAMPLE"_status.log" &
The command is executed in the...
1,625
Posted By Kibou
Sample output, kibou@laptop:~$ touch...
Sample output,

kibou@laptop:~$ touch /tmp/file{1..5}
kibou@laptop:~$ find /tmp/ -name file*
find: Las rutas deben preceder la expresión: file1
Uso: find [-H] [-L] [-P] [-Onivel] [-D...
1,625
Posted By Don Cragun
There is a HUGE difference between: find ....
There is a HUGE difference between:
find . -name "*.jpg"and:
find . -name *.jpgbut, if there are no files with a name ending with the string ".jpg" in the directory where you invoke these commands,...
1,625
Posted By Kibou
This can be easily mistaken after you have seen...
This can be easily mistaken after you have seen something like this

find -name "*.jpg"

which it does actually expands. The find command does not expand the same way the shell does.
1,625
Posted By Corona688
* does not expand inside double quotes. ...
* does not expand inside double quotes.

./main "$FILENAME"*.root $LUMIFILE $CONFIGDEFAULTFILE
1,700
Posted By Aia
#!/bin/bash for f in *_M-130_*.root; do ...
#!/bin/bash

for f in *_M-130_*.root; do
keep="${f%_?_???.root}"
if [[ "$keep" != "$f" ]]; then
echo mv "$f" "${keep}.root"
fi
done
Showing results 1 to 25 of 57

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