Search Results

Search: Posts Made By: PikK45
1,406
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";
3,057
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,894
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,894
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,915
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,894
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,257
Posted By RudiC
Remove the ' in the commented out line.
Remove the ' in the commented out line.
2,894
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,112
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,469
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,408
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,500
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,187
Posted By RudiC
Try also (untested):awk '{sub /^2..../, "&\n")}1'...
Try also (untested):awk '{sub /^2..../, "&\n")}1' file
7,072
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,179
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,023
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,917
Posted By elixir_sinari
Check the delimiters for substitution.
Check the delimiters for substitution.
3,683
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,...
2,015
Posted By balajesuri
With a modern shell: ...
With a modern shell:
file_name="rscclog_2013-03-25.txt;3"
mv $file_name ${file_name%;*}
20,003
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,961
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,790
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,552
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,381
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,173
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:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy