Search Results

Search: Posts Made By: PikK45
1,375
Posted By Aia
my $pattern =...
my $pattern = "/abc/def/ghi/xyz.$ENV{HOSTNAME}.2???.??.??.??.??.*";
my ($file) = qx{ls -t $pattern};
print "THE OUTFILE IS ......................... $file";
2,931
Posted By RudiC
Assumed that PATH1 and PATH2 WERE defined, it...
Assumed that PATH1 and PATH2 WERE defined, it still wouldn't work as it would need a second expansion by the shell after $I or $v have been expanded. You need to use eval for that, but this can be...
2,575
Posted By sea
Also, your (custom modified) $PATH looks VERY...
Also, your (custom modified) $PATH looks VERY limited, will it find find, ls, grep, awk or even your shell?
With that $PATH, it wont find any of these, if they are at their regular locations. (edit:...
2,575
Posted By Corona688
Don't do that, ever. There's many reasons...
Don't do that, ever. There's many reasons DOS-style path handling never became popular outside DOS.
1,903
Posted By Don Cragun
awk: Use awk ': with the script: printf(:...
awk: Use awk
': with the script:
printf(: print
"%s%s": two strings
,$0: where the 1st string is the current input line (without the trailing <newline> character)
,(NR%2)?"\t":"\n"): and the 2nd...
2,575
Posted By rbatte1
If the executable is /home/execs/testing/compare,...
If the executable is /home/execs/testing/compare, then you will either need to:-

Give it the full path in your script, i.e. call /home/execs/testing/compare
Ensure that /home/execs/testing is...
3,128
Posted By RudiC
Remove the ' in the commented out line.
Remove the ' in the commented out line.
2,575
Posted By rbatte1
Firstly, I would remove the space between #! and...
Firstly, I would remove the space between #! and /bin/sh on the first line.

Can you post us the full error message? I'm assuming that compare is a function declared within /my_data/environment,...
1,033
Posted By Skrynesaver
perl -Mstrict -e 'sub iso_stamp{ my...
perl -Mstrict -e 'sub iso_stamp{
my $epoch=shift;my @time=localtime($epoch);
return sprintf "%04d-%02d-%02d.%02d.%02d",$time[5]+1900,$time[4]+1,@time[3,2,1];
}
my...
3,411
Posted By Yoda
For your input file, try:- awk -F,...
For your input file, try:-
awk -F, '{$(NF-2)=$(NF-1) FS $NF;NF-=2}1' OFS=, file
1,371
Posted By RudiC
Tryawk -F, ' {FN=$1"_a.txt" ...
Tryawk -F, ' {FN=$1"_a.txt"
NN=split ($NF, NAMES, ";")
getline X < $2; print X > FN
while (getline X < $3)...
1,453
Posted By Akshay Hegde
following would give output but }!a[$1,$2]' is...
following would give output but }!a[$1,$2]' is not good, it is more efficient to use var in array instead of array[var]
$ awk -F"|" 'FNR==NR{a[$1,$2]++;next}!a[$1,$2]' file1 file2
2,158
Posted By RudiC
Try also (untested):awk '{sub /^2..../, "&\n")}1'...
Try also (untested):awk '{sub /^2..../, "&\n")}1' file
6,972
Posted By balajesuri
Just a thought: If you're want to check whether...
Just a thought: If you're want to check whether the file format is dos or unix, then you may do so using the file command too.

$ file dosfile.txt
dosfile.txt: ASCII text, with CRLF line...
1,161
Posted By Don Cragun
Another way to do this using awk once instead of...
Another way to do this using awk once instead of using sed once for each line in the equivalences file is:
awk '
BEGIN { OFS = "\t"}
FNR == NR {ID[$1] = $2;next}
{ if(FNR == 1) sub(/ID/,...
1,005
Posted By pamu
try awk 'NR==1{S=$NF} NR>1{$(NF+1)=S}1'...
try

awk 'NR==1{S=$NF} NR>1{$(NF+1)=S}1' file
2,758
Posted By elixir_sinari
Check the delimiters for substitution.
Check the delimiters for substitution.
3,560
Posted By alister
You will continue to trigger that error so long...
You will continue to trigger that error so long as the contents of the txt file in the highlighted command substitution exceed your system's available memory (or process mem limit).

Regards,...
1,910
Posted By balajesuri
With a modern shell: ...
With a modern shell:
file_name="rscclog_2013-03-25.txt;3"
mv $file_name ${file_name%;*}
19,952
Posted By ctsgnb
@Pikk45 Wrong : basename would have given the...
@Pikk45
Wrong : basename would have given the name of the zip file, and not the name of the csv file that is in the zip archive . ;)
1,896
Posted By Yoda
This is Useless Use of grep | awk...
This is Useless Use of grep | awk (http://partmaps.org/era/unix/award.html#grep)

Another approach using GNU grep:
grep -o "uid.*" file
1,713
Posted By Corona688
That's ironic, since sed may have problems with...
That's ironic, since sed may have problems with huge lines, but tr never will!
1,529
Posted By anbu23
$ set $(echo $word | fold -2) $ echo $1 $2 $3...
$ set $(echo $word | fold -2)
$ echo $1 $2 $3 $4 $5
ex ce ll en cy
1,369
Posted By RudiC
No, it closes stdout and stderr entirely - your...
No, it closes stdout and stderr entirely - your shell won't have any output channel any more.
2,109
Posted By rdrtx1
try also: paste -d, - - - - - < sample.txt >...
try also:
paste -d, - - - - - < sample.txt > sampleoutput.csv
Showing results 1 to 25 of 50

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