newbie needs help batching awk, tabitha


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting newbie needs help batching awk, tabitha
# 8  
Old 08-28-2012
raj, your code works well although it does create an extraneous column of data (column 8) that doesn't appear to correlate to anything in the two input files, and it also leaves out one column of data, but I can live with these. Also, I had to remove the $3 in the print statement

raj, the output files from your code get named: outputfile1.txt outputfile1+1.txt outputfile2+1.txt etc. is there a simple way for it to add the values together


elixir, your code also ran on the files, but only gave one output file that the data was from the last set of inputfiles in the directory. I think all the previous are getting overwritten. Your code produced two extraneous columns of data that doesn't correlate to either of the inputfiles. Columns 6 and 9

I really realy thank you guys sooo much for helping me, hopefully these little qwerkies are easy to fix???

Last edited by atjurhs; 08-28-2012 at 05:20 PM..
# 9  
Old 08-29-2012
atjurhs I had not made any changes to your code related to output of column in awk statment.
As for the file name is concerned check the value of $i coming in the code on your system. As for me its giving correct value. Try replace ${i} with $i also in output file name.

If still not working get back to me with $i value.
# 10  
Old 08-29-2012
raj, I'm sorry, I wasn't very clear. In part of the code you had written

Code:
{print $1,$2,$3"_L000102.txt"}

and in order for it to run without a sybtax error, I re-wrote it as
Code:
{print $1,$2"_L000102.txt"}

also by trial and error I fixed the outputfile1+1.txt format by commenting out
Code:
i=$(expr $i + 1)

and just using
Code:
(( i = i+1))


I still need to figure out where the extraneous columns are coming from but as it is it meets my needs

Last edited by Franklin52; 08-30-2012 at 04:32 AM.. Reason: Please use code tags for data and code samples
# 11  
Old 08-30-2012
is your problem solved now or still output file is not as you expected.
have you printed the value of $i with my code.
# 12  
Old 08-30-2012
Quote:
Originally Posted by raj_saini20
is your problem solved now or still output file is not as you expected.
have you printed the value of $i with my code.
it's mostly solved, and I say only because I still get one extraneous column and it leaves out one column.

as for printing $i can I just throw in print$i statements wherever I like?

thanxs Tabitha
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Basic awk...newbie quetion

Hi, I was trying to change the value of the 4th column (put '1' in the 4th column of each row). My awk command is: awk -F, '{$3=1;}1' OFS= input.txt > ./test_out.txt My input file is: a 1 2 31 b 4 5 61 c 7 8 91 My output file (test_out.txt)is: a 1 2 31 b 4 5 61 c 7 8 91 What... (4 Replies)
Discussion started by: pc2001
4 Replies

2. Shell Programming and Scripting

Newbie AWK Question

$ awk -f awk1.awk Where awk1.awk reads: BEGIN { printf ("Name = Smith, Richard" > "awk1" \n) printf ("Name = Johnson, Waylan" > "awk1" \n) printf ("Name = Brown, Pat" > "awk1" \n) } If I get rid of "\n", awk1 file gets created but all the names... (3 Replies)
Discussion started by: ora_umair
3 Replies

3. Shell Programming and Scripting

Help with awk for a newbie

Hi there, greetingt to everybody. I have configured syslog-ng to get messages over UDP saving logs into a text file, it works fine. I need to store the content of this file in several files depending from some criteria that I try to explain you with some examples : Suppose the content of my log... (5 Replies)
Discussion started by: capnino
5 Replies

4. Shell Programming and Scripting

Help a newbie please with awk if else statements

Hi, Despite reading the Conditional Statements chapter in the O'Reilly Sed & Awk book several times and looking at numerous examples, I cannot for the life of me get any kind of if ... else statement to work in my awk scripts! My scripts work perfectly (as they are written at least) and do what... (4 Replies)
Discussion started by: jonathanm
4 Replies

5. Shell Programming and Scripting

Grep causing long delay (batching) whilst piping

Hi all. I have a problem at work which I have managed to break down into a simple test scenario: I have written a monitoring script that outputs every second the status of various processes, but for now, lets just print the date input.sh: while true do date sleep 1 done This... (9 Replies)
Discussion started by: spudtheimpaler
9 Replies

6. Shell Programming and Scripting

Need help with AWK (newbie)

Hello all I have a file with below data, I need to add a third column as XXXX if the first coloumn (H180620081) last number is "1" and YYYY if the first coloumn last number is "2" Can it be done with AWK, I would appreciate if anyone could help me ou with this. H180620081 31310 ... (11 Replies)
Discussion started by: udaybo
11 Replies

7. Shell Programming and Scripting

Need Help with AWK or SED (Newbie)

Hello, I have a text file in below format, how do I put a header and assign field names to the file with either AWK or SED STRT~ VA ~23606 ~TM14~8506~1485 (page 1) STRT~ VA ~23662 ~TM17~8362~1783 (page 2) STRT~ VA ~23662 ~TM17~8362~1783 STRT~ VA ~23662 ~TM17~8362~1783 STRT~ VA ~23662... (1 Reply)
Discussion started by: udaybo
1 Replies

8. Shell Programming and Scripting

awk newbie

I would like to parse a file and use each record to create a unique file where the name of the file created is taken from the 3rd field. Example: here are 3 records. 000007 0110 07-0001583 20060802132213 20060801112601 000007 0110 07-0001584 ... (4 Replies)
Discussion started by: zoo591
4 Replies

9. Shell Programming and Scripting

batching files together

I'm looking after part of an application which batches up files concatanates them together and then moves the concatanated files to another directory. The problem I have is that the box runs Windows 2003 and UNIX shell emulation is provided by MKS Toolkit, when 10,000 or more files arive in the... (1 Reply)
Discussion started by: pookie
1 Replies

10. UNIX for Dummies Questions & Answers

batching files

HI, Suppose I have thousand files in one directory and they can keep increasing ie /home/rooh Then I want to create a batch of 100 files and then compress that batch file and ftp them somewhere else. And morever the files in the batch will be moved to somewhere else. Can you please help... (21 Replies)
Discussion started by: rooh
21 Replies
Login or Register to Ask a Question