Remplacer des lignes par d'autres avec sed
Résolu
CYG
-
jipicy Messages postés 41342 Statut Modérateur -
jipicy Messages postés 41342 Statut Modérateur -
Bonjour,
j'ai besoin d'une commande sed avec laquelle je peux remplacer des linges par d'autres lignes dans un méme fichier
exemple:
le fichier <com.txt>
Method_phasefilt: goldstein: size, alpha, overlap: 32 0.9 11
1D Smoothing kernel for |spectrum|: 0.111111 0.222222 0.333333 0.222222 0.111111
Input_file: diff
Data_output_file: diff.filt
Data_output_format: complex_real4
First_line (w.r.t. original_master): 3500
Last_line (w.r.t. original_master): 4711
First_pixel (w.r.t. original_master): 2844
Last_pixel (w.r.t. original_master): 4100
Multilookfactor_azimuth_direction: 5
Multilookfactor_range_direction: 1
Number of lines (multilooked): 1599
Number of pixels (multilooked): 1177
**********************************************
Method: schwabisch
Data_output_file: demradar
Data_output_format: real4
First_line (w.r.t. original_master): 8400
Last_line (w.r.t. original_master): 16634
First_pixel (w.r.t. original_master): 2792
Last_pixel (w.r.t. original_master): 3969
Multilookfactor_azimuth_direction: 5
Multilookfactor_range_direction: 1
Ellipsoid (name,a,b): WGS84 6.378137e+06 6.3567523e+06
donc je veux remplacer les lignes en gras (les lignes 104,105,106,107) par les lignes soulignées(91,92,93,94)
quelqu'un peut m'aider
merci d'avance,
CYG
j'ai besoin d'une commande sed avec laquelle je peux remplacer des linges par d'autres lignes dans un méme fichier
exemple:
le fichier <com.txt>
Method_phasefilt: goldstein: size, alpha, overlap: 32 0.9 11
1D Smoothing kernel for |spectrum|: 0.111111 0.222222 0.333333 0.222222 0.111111
Input_file: diff
Data_output_file: diff.filt
Data_output_format: complex_real4
First_line (w.r.t. original_master): 3500
Last_line (w.r.t. original_master): 4711
First_pixel (w.r.t. original_master): 2844
Last_pixel (w.r.t. original_master): 4100
Multilookfactor_azimuth_direction: 5
Multilookfactor_range_direction: 1
Number of lines (multilooked): 1599
Number of pixels (multilooked): 1177
**********************************************
Method: schwabisch
Data_output_file: demradar
Data_output_format: real4
First_line (w.r.t. original_master): 8400
Last_line (w.r.t. original_master): 16634
First_pixel (w.r.t. original_master): 2792
Last_pixel (w.r.t. original_master): 3969
Multilookfactor_azimuth_direction: 5
Multilookfactor_range_direction: 1
Ellipsoid (name,a,b): WGS84 6.378137e+06 6.3567523e+06
donc je veux remplacer les lignes en gras (les lignes 104,105,106,107) par les lignes soulignées(91,92,93,94)
quelqu'un peut m'aider
merci d'avance,
CYG
A voir également:
- Remplacer des lignes par d'autres avec sed
- Remplacer disque dur par ssd - Guide
- Remplacer par word - Guide
- Partager des photos en ligne - Guide
- Remplacer coco - Accueil - Réseaux sociaux
- Quel site pour remplacer coco - Accueil - Réseaux sociaux
1 réponse
Salut,
;-))
[tmpfs]$ cat -n plop
1 Method_phasefilt: goldstein: size, alpha, overlap: 32 0.9 11
2 1D Smoothing kernel for |spectrum|: 0.111111 0.222222 0.333333 0.222222 0.111111
3 Input_ diff
4 Data_output_ diff.filt
5 Data_output_format: complex_real4
6 First_line (w.r.t. original_master): 3500
7 Last_line (w.r.t. original_master): 4711
8 First_pixel (w.r.t. original_master): 2844
9 Last_pixel (w.r.t. original_master): 4100
10 Multilookfactor_azimuth_direction: 5
11 Multilookfactor_range_direction: 1
12 Number of lines (multilooked): 1599
13 Number of pixels (multilooked): 1177
14 **********************************************
15 Method: schwabisch
16 Data_output_ demradar
17 Data_output_format: real4
18 First_line (w.r.t. original_master): 8400
19 Last_line (w.r.t. original_master): 16634
20 First_pixel (w.r.t. original_master): 2792
21 Last_pixel (w.r.t. original_master): 3969
22 Multilookfactor_azimuth_direction: 5
23 Multilookfactor_range_direction: 1
24 Ellipsoid (name,a,b): WGS84 6.378137e+06 6.3567523e+06
[tmpfs]$ sed -n '18,21 p' plop > tmp
[tmpfs]$ cat tmp
First_line (w.r.t. original_master): 8400
Last_line (w.r.t. original_master): 16634
First_pixel (w.r.t. original_master): 2792
Last_pixel (w.r.t. original_master): 3969
[tmpfs]$ sed '6,9 {:z;N; 9! bz; s/^.*$/cat tmp/e}' plop
Method_phasefilt: goldstein: size, alpha, overlap: 32 0.9 11
1D Smoothing kernel for |spectrum|: 0.111111 0.222222 0.333333 0.222222 0.111111
Input_ diff
Data_output_ diff.filt
Data_output_format: complex_real4
First_line (w.r.t. original_master): 8400
Last_line (w.r.t. original_master): 16634
First_pixel (w.r.t. original_master): 2792
Last_pixel (w.r.t. original_master): 3969
Multilookfactor_azimuth_direction: 5
Multilookfactor_range_direction: 1
Number of lines (multilooked): 1599
Number of pixels (multilooked): 1177
**********************************************
Method: schwabisch
Data_output_ demradar
Data_output_format: real4
First_line (w.r.t. original_master): 8400
Last_line (w.r.t. original_master): 16634
First_pixel (w.r.t. original_master): 2792
Last_pixel (w.r.t. original_master): 3969
Multilookfactor_azimuth_direction: 5
Multilookfactor_range_direction: 1
Ellipsoid (name,a,b): WGS84 6.378137e+06 6.3567523e+06
[tmpfs]$ A adapter en fonction de tes lignes, rajouter "-i.BAK" pour une édition en place...
;-))
merci d 'avance
CYG
merci d avance;
CYG