Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: krava
  • Content: Threads
  • Order by date
  1. krava

    gappy table

    Hi, Could somebody help me to solve this problem? I copy here part of the table (I hope it will keep the format when you receive this thread): ESO 268-044 4a 70.0 9.0 272.3 251.8 113.1 2.2 14.5 10 2 ESO 323-042 4c 54.0 9.0 160.1 4.0 ESO 358-006 4b 48.5...
  2. krava

    extract number

    hi I have file names like: "data1", "esdu2sdt" ... "da15efe" I would just like to extract number from filenames. There is absolutely no rule where the numbers are in the names. How to do this? thanks k.
  3. krava

    duplicated records

    Hi I would like to remove duplicated records based on 3 columns. For example, 1 2.2 3.2 4.2 2 3.2 4.2 5.2 3 4.2 5.2 6.2 4 5 5 5 5 5 5 5 6 7.2 8.2 9.2 7 8.2 9.2 10.2 8 5 5 5 9 10.2 11.2 12.2 10 11.2 12.2 13.2 I would like to get 1 2.2 3.2 4.2 2 3.2 4.2 5.2 3 4.2 5.2 6.2 4 5 5 5 6 7.2 8.2...
  4. krava

    delete blanko characters

    Hi, I have datafile (comma separated) like this one 342, 0.00279, 0.01163, 3.03125 342, 0.00279, 0.01163, 3.03125 342, 0.00279, 0.01163, 3.03125 342, 0.00279, 0.01163, 3.03125 .................................. and I would like to delete empty...
  5. krava

    crossmatching

    Hi, I would like to cross-match 2 files with awk using different columns. Example: file1 with 3 CSV columns: A1,B1,C1 1,2,3 4,5,6 7,8,9 file2 similary: A2,B2,C2 2,11,13 7,34,56 8,32,12 Matching 2 files using B1 column of the first file and A2 column of the second should give...
  6. krava

    substitute string

    hi, i would like to substitute a substring with the given string in filanames. I wrote this script that use awk: function subFlNmPart(){ for i in `find -name "$1" -print`; do bn="$(basename $i)"; #eval o=\"$( awk -v inFl=$bn -v target=$2 -v word=$3 'BEGIN{ sub(target, word, inFl)...
  7. krava

    print out columns

    hi, I would like to write out certain columns (number is not fixed) from datafile. My program starts like: echo "chose columns separated by commas"; read col; awk -v c=$col 'BEGIN{ search=","; n=split(c,a,search); for (i=1;i<=n;i++) { print a[i]; }}{......}' dataFile.dat >...
  8. krava

    sort data

    Hi I would like to sort datatable by column 2 for example. I wrote this: awk '{a[$2>=10?$2:0$2]=$0} END {n=asorti(a,dest); for (i=1;i<=n;i++){print dest[i]}}' sample1.dat It works but fails when I have negative numbers in datatable. Is there some quick solution for this? thanks k.
  9. krava

    buffer

    Hi, May I read out the content of the buffer into some bash variable and how? thanks k
  10. krava

    sed in BASH

    Hi all, I am trying to enable this BASH function which use sed command function cdc{ eval $x=\"$(sed 's_\\_/_g' $1)\" cd $x } USAGE: cdc c:\users\us2\ Aim is to replace c:\users\us2\ into c:/users/us2/ to be executable by Cygwin. I am not sure why this does not work. Any idea? Thanks...
  11. krava

    boolean

    Hi, I would like to evaluate $bool bash-variable with help of this awk command eval $bool=\\$(awk -v str=$bn 'BEGIN{print (match(str,/tau(1|2|3|4|5|6)/) ? 1 : 0)}'); So, when str in awk match this regexp $bool should be 1 (otherwise 0) Where I make misstake here? thanks
  12. krava

    matching tables

    hello I have this bash script to match 2 tables using one column. function awkcrossmatch() { if [ $# = 3 ] then awk -v col="$1" '{v=FNR==1?"\n":$col} NR==FNR {a[v]=$col; b[v]=$0; next} v in a {print b[v],$0}' $2 $3 elif [ $# = 4 ] then awk -v col="$1"...
  13. krava

    conversion

    Hi, I would like to have bash function that would convert space-separated data table into comma-separated one. This is what I put together so far function dat2csv() { for fl in `find -type f -name "$1" -print`; do #echo $fl; bNm="$(basename $fl .dat)"; # echo $bNm...
  14. krava

    eval

    Hi, I am trying to use awk in bash and have no idea why this not works for fl in `find -name "*.jpg"`;do echo $fl; eval $x=\"$(awk -v name=$fl 'BEGIN{print match(name,/less/)}')\"; echo $x; done I would use $x differently afterwards, depending on result ($x = 0 or not) but first to figure...
  15. krava

    header

    hi, I wrote a simple bash script: putHeader(){ for fl in `find -name "$1"`; do echo $fl; tmpNm=$(basename $fl).tmp; awk -v hd=$2 'BEGIN{print "hd"}' $fl > $tmpNm #sed -e '1i \ $2' $fl > $tmpNm rm $fl mv $tmpNm $fl done } I would like to put header into specified files like: putHeader...
  16. krava

    find

    hi I am trying to manipulate files that contain some of these words tau1, tau2, tau3, tau4, tau5 or tau6 I wrote this one for fl in `find -type f -regex '.*tau\(1\|2\|3\|4\|5\|6\).*' -print`; do echo $fl; done and tried this for fl in `find -regextype posix-egrep -type f -regex...
  17. krava

    split string

    Hi I would like to have a function in .bashrc that would split a string into substrings (according to given separator) and to return a given substring. Something like: function splitString() { #echo $1; awk -v name=$1 -v sep=$2 -v field=$3 'BEGIN{split(name,a,sep); print a[field]}' return...
  18. krava

    copy

    Hi, I would like to copy all files, let say all that begins with "file*", from ALL subdirectories into the directory with the same structure of subdirectories. for example : dir1--+ | +--subDir1 --+--subSubDir1 | +-- subSubDir2 -- subDir2 -- subDir3--+--subSubDir1 into dir2--+ |...
  19. krava

    table

    Hi, How to delete everything and keep just numbers in this table? xl_1=1.14653 xr_1=1.24653 yl_1=4.14801 yr_1=5.64801 xl_2=1.14653 xr_2=1.24653 yl_2=5.64801 yr_2=7.14801 xl_3=1.24653 xr_3=1.34653 yl_3=3.07031 yr_3=4.57031 xl_4=1.24653 xr_4=1.34653 yl_4=4.57031 yr_4=6.07031 xl_5=1.34653...

Part and Inventory Search

Back
Top