Sponsored Content
Full Discussion: unix awk/sed program
Top Forums UNIX for Advanced & Expert Users unix awk/sed program Post 302178495 by mnnarendra on Tuesday 25th of March 2008 04:20:22 PM
Old 03-25-2008
unix awk/sed program

i need a sample unix awk/sed program to replace param3 in a file.

i have sample file a.dat with the following format/length (week 8, sku 20, store 20 and qty 8). all store id's which end with _2 needs to be replaced with div id 2. all store id's which end with _1 needs to be replaced with div id 1.

W23_2009275 999_2 8.991052
W24_2009275 999_2 8.991052
W25_2009275 97_2 8.991052
W26_2009275 96_2 8.991052
W51_2008102 99_1 2.851916
W52_2008102 96_1 2.851916
W51_2008104 96_1 5.468747
W52_2008104 999_1 5.468747

new file b.dat should look like this

W23_2009275 2 8.991052
W24_2009275 2 8.991052
W25_2009275 2 8.991052
W26_2009275 2 8.991052
W51_2008102 1 2.851916
W52_2008102 1 2.851916
W51_2008104 1 5.468747
W52_2008104 1 5.468747
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

combining unix commands and awk program

Dear Experts I am trying to find if it is possible to combine unix commands in awk program. For example if it is possible embed rm or ls or any unix command inside the awk program and while it is reading the file besides printing be able to do some unix commands. I am thinking may be just print... (2 Replies)
Discussion started by: Reza Nazarian
2 Replies

2. Shell Programming and Scripting

modify and use awk sed program

The following awk script creates a file b.dat. awk '{print substr($0,1,27),substr($2,index($2,"_")+1)," ",substr($0,49)}' a.dat > b.dat I need this script to be modified to also sum $3 values by distinct $1 and $2 fields. Current file W2_2009275 2 8 W2_2009275 2 7 W1_2009275 1... (3 Replies)
Discussion started by: mnnarendra
3 Replies

3. Shell Programming and Scripting

shell program with sed

I want to substitute a charactor "PAN" with "TAN" in a shell, I used sed command in shell, it wo'nt work but the same is run from command prompt it was successful. the command is sed ' s/PAN/TAN/g ' <i/p> > <o/p> sed ' s/^M/^M/g ' <i/p> > <o/p> (1st ^M is Ctrl+V+M, 2nd should be line feed/next... (1 Reply)
Discussion started by: anil_kut
1 Replies

4. Shell Programming and Scripting

Problem with awk awk: program limit exceeded: sprintf buffer size=1020

Hi I have many problems with a script. I have a script that formats a text file but always prints the same error when i try to execute it The code is that: { if (NF==17){ print $0 }else{ fields=NF; all=$0; while... (2 Replies)
Discussion started by: fate
2 Replies

5. UNIX for Dummies Questions & Answers

What should be precedence of using awk, sed, head and tail in UNIX?

Hi All, I am new to unix. In this forum some days back, I have read something like below: 1) Do not use perl if awk can do your work. 2) Do not use awk if sed can do your work. . . . I do not re-collect the whole thing. I think it is good to know the precedence of using these... (2 Replies)
Discussion started by: Prathmesh
2 Replies

6. Shell Programming and Scripting

Join the line on delimiter using sed/awk in UNIX

I've input as , abcd| ef 123456| 78| 90 Desired output as, abcdef 1234567890 Anyone please give the solution. (5 Replies)
Discussion started by: jinixvimal
5 Replies

7. Shell Programming and Scripting

Convert Update statement into Insert statement in UNIX using awk, sed....

Hi folks, I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex. I have a bunch of update statements with all columns in a file which I need to convert into insert statements. UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies

8. How to Post in the The UNIX and Linux Forums

Help me in awk or sed in UNIX

I have a fixed length file that looks like a@ a00 a00000 a00 a000000 a00 a0000 a0000 a00000000 a01 a@ a1 a2 a11 a22 a12 a13 a44 a45 a54 a65 a76 a77 a@ a1 a3 a6 a7 a9 a8 a2 a7 a8 a8 a9 a0 b@ b00 b00000 b00... (1 Reply)
Discussion started by: RJG
1 Replies

9. Shell Programming and Scripting

Help me in awk or sed in UNIX

I have a fixed length file a.txt that looks like a@ a00 a00000 a00 a000000 a00 a0000 a0000 a00000000 a01 a@ a1 a2 a11 a22 a12 a13 a44 a45 a54 a65 a76 a77 a@ a1 a3 a6 a7 a9 a8 a2 a7 a8 a8 a9 a0 b@ b00... (7 Replies)
Discussion started by: RJG
7 Replies

10. UNIX for Beginners Questions & Answers

UNIX for learning sed/awk/grep..etc..

Greetings all, I am looking for a version of Linux that I can practice my scripting skills on. Currently, I support a massive system running on AIX. I want to do more with awk, sed, grep, and even perl. I am looking for something I can throw on a VM on my personal laptop and mess around with.... (5 Replies)
Discussion started by: jeffs42885
5 Replies
Psi Release 3.0 						1

cints(1)	   PSI COMMANDS FOR UNIX USERS		 cints(1)

NAME
cints - One- and Two-Electron (Derivative) Integrals Program DESCRIPTION
The program cints computes (derivative) integrals of some one- and two-electron operators which appear in quantum chemical theories over symmetry-adapted cartesian and spher- ical harmonics Gaussian functions. DOCUMENTATION
Man-page is no longer supported. HTML-based documentation is in index.html. input.dat Input file FILE30 Checkpoint file FILE31 Input for this program is read from the file input.dat. Most of the keywords are not neccessary for routine task. The following keywords are valid: PRINT = integer Determines amount of information to be printed. Defaults to 0. CUTOFF = integral The negative of the exponent of the cutoff imposed on two-electron integrals. Default is 15 which results in two-electron integrals of greater than 1e-15 magnitude to be stored in FILE33. S_FILE = integer The file number to store overlap integrals. Defaults to 35. T_FILE = integer The file number to store kinetic energy integrals. Defaults to 35. V_FILE = integer The file number to store nuclear attraction integrals. Defaults to 35. ERI_FILE = integer Psi Release 3.0 Last change: 04 Jan, 2000 1 cints(1) PSI COMMANDS FOR UNIX USERS cints(1) The file number to store electron repulsion integrals. Defaults to 33. Psi Release 3.0 Last change: 04 Jan, 2000 2
All times are GMT -4. The time now is 09:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy