Search Results

Search: Posts Made By: joseamck
Forum: Programming 06-17-2012
2,737
Posted By shamrock
Do the /sw/lib and /sw/include dirs exist on the...
Do the /sw/lib and /sw/include dirs exist on the system and post the output of the following...
ls -latr /sw/lib /sw/include
22,356
Posted By drl
Hi. A slightly different solution in perl: ...
Hi.

A slightly different solution in perl:
#!/usr/bin/env bash

# @(#) s1 Demonstrate sort numeric items on a line, perl.

pe() { for _i;do printf "%s" "$_i";done; printf "\n"; }
pl() {...
22,356
Posted By Scrutinizer
perl -lane '$,=" "; print sort { $a <=> $b } @F'...
perl -lane '$,=" "; print sort { $a <=> $b } @F' infile
22,356
Posted By Scrutinizer
Or just blow your own bubbles... ;) awk...
Or just blow your own bubbles... ;)
awk '{c=1;while(c!=""){c=""; for(i=1;i<NF;i++){n=i+1; if($i>$n){c=$i;$i=$n;$n=c}}}}1' infile
22,356
Posted By complex.invoke
@joseamck just run the script sort.sh with...
@joseamck
just run the script sort.sh with your file, such as:

bash sort.sh your_file
22,356
Posted By agama
From the looks of things you didn't name the file...
From the looks of things you didn't name the file code.awk. If you run the command ls -al code.awk what do you get? The fact that awk says it cannot open the file means that the file isn't in the...
22,356
Posted By complex.invoke
[root@node2 ~]# cat sort.sh while read line;...
[root@node2 ~]# cat sort.sh
while read line; do
ary=(${line})
for((i=0; i!=${#ary[@]}; ++i)); do
for((j=i+1; j!=${#ary[@]}; ++j)); do
if (( ary[i] > ary[j]...
3,840
Posted By ahamed101
Try this... awk 'NR==3{print "newtext"}1'...
Try this...

awk 'NR==3{print "newtext"}1' input_file > out_file
If solaris, use nawk!

--ahamed
5,695
Posted By rdcwayx
With echo $line, It will be easy for...
With echo $line, It will be easy for verification. So if confirm the result is right, you can remove it.

By the way, don't forget to use code tage in this forum
...
5,695
Posted By rdcwayx
Something like this? If it is fine, remove the...
Something like this? If it is fine, remove the echo line.
while read line
do
echo $line;
awk -v val=$line '{if (val>=$1) {print;exit}}' file2
done < file1
Showing results 1 to 10 of 10

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