Monday, July 01, 2013

 

[linux] comparar dos listas de numeros en dos archivos distintos

#! /bin/bash

# grep -v Desc deldirac.txt > tmp.txt
# # awk 'BEGIN {FS=" "} / / {print $1,$2}' tmp.txt
# awk 'BEGIN {FS=" "} / / {print $2}' tmp.txt > names_ids.txt
# awk 'BEGIN {FS=" "} / / {print $1}' tmp.txt > new_ids.txt
# cat names_ids.txt | xargs -I{} grep -l {} */*.dat */*.descr  | sort | uniq > filetochange.txt
# cat names_ids.txt | xargs -I{} grep -wu -m 1 {} Descr/fich_visu_param.dat | cut -b 1-3 >> old_ids.txt
# cat old_ids.txt | 

let counter=1;
let thenewid=1;
for line in $(cat ./old_ids.txt); do
  (( thenewid = $(head -$counter ./new_ids.txt | tail -1) ))
  let counter+=1;
  echo "$counter: -> $line will be $thenewid";
done;

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?