Sponsored Content
Top Forums Shell Programming and Scripting File processing using script needs help Post 302359031 by steadyonabix on Monday 5th of October 2009 04:05:41 PM
Old 10-05-2009
Code:
nawk -F: '
  NR == 1 { last_server = $1 }
{
  this_server = $1
  if ( this_server == last_server )
    s_count ++
  else{
    print last_server":"s_count
    s_count = 1
  }
  print $0
  last_server = $1
} END {
    print last_server":"s_count
} ' infile > outfile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Have a shell script check for a file to exist before processing another file

I have a shell script that runs all the time looking for a certain type of file and then it processes the file through a series of other scripts. The script is watching a directory that has files uploaded to it via SFTP. It already checks the size of the file to make sure that it is not still... (3 Replies)
Discussion started by: heprox
3 Replies

2. Shell Programming and Scripting

perl script for file processing

Aim: To scan a file and ignore all characters that has an ASCII value from 0 to 31 and 127 to 255 and accept only those characters having an ASCII between 32 and 126. Script: #!/usr/local/bin/perl $filename = "$ARGV"; if (-e $filename) { open(OUT, "${filename}") || die "can't... (10 Replies)
Discussion started by: SEEHTAS
10 Replies

3. Shell Programming and Scripting

KSH script -text file processing NULL issues

I'm trying to strip any garbage that may be at the end of my text file and that part is working. The problem only seems to be with the really long lines in the file. When the head command is executed I am directing the output to a new file. The new file always get a null in the 4096 position but... (2 Replies)
Discussion started by: geauxsaints
2 Replies

4. Shell Programming and Scripting

awk, perl Script for processing a single line text file

I need a script to process a huge single line text file: The sample of the text is: "forward_inline_item": "Inline", "options_region_Australia": "Australia", "server_event_err_msg": "There was an error attempting to save", "Token": "Yes", "family": "Family","pwd_login_tab": "Enter Your... (1 Reply)
Discussion started by: hmsadiq
1 Replies

5. Shell Programming and Scripting

Simple Script needed for Processing CSV file perl

I am new to perl, and need a script to pull a CSV file, strip out 2 leading columns, and 2 ending columns, and resave the file in a new location. The file is basic and has less than 10,000 records. Secondly, can I schedule perl scripts to run daily? Can someone provide the basic script to... (1 Reply)
Discussion started by: cobbjob
1 Replies

6. Shell Programming and Scripting

2 file processing script in C shell

I want to use an awk for the following scenario but not sure if it will work or not. I have two input file: F1 and F2 F1 02 05 08 F2 00 01 02 03 04 05 06 07 08 09 10 (1 Reply)
Discussion started by: jclanc8
1 Replies

7. Shell Programming and Scripting

File Processing in shell script

i have a file with following type of data abcd : gggggg gggggg ; 1234 gggggg ; 5678 gggggg ; 3434 gggggg ; 6565 gggggg ; 1231 1234 ; vvvv ;Eng=Myfirstname 5678 ; xyzf ;Eng=Mysecondname 3434 ; xyzf ;Eng=Mythirdname 6565 ; xyzf ;Eng=Mysfourthname 1231 ; xyzf ;Eng=Mysfifthname... (7 Replies)
Discussion started by: telangmadhuri
7 Replies

8. Shell Programming and Scripting

Need help in File Processing Script

I made one script in shell, but it is not running in my server. So i am trying to make perl for the same. Can anyone help me? #!/bin/sh p=`date '+20%y%m%d'` cp Process_*"$p"*.txt /tmp/ cat /tmp/number.txt | egrep -v "Prefix|---|" | sed -e 's/ //g' -e '/^$/d' | nawk -F"->"... (4 Replies)
Discussion started by: lecria
4 Replies

9. Programming

awk processing / Shell Script Processing to remove columns text file

Hello, I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this : This is the output of ls command : I stored the output in a file filelist 1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies

10. Shell Programming and Scripting

How to log file processing details to database table usnig UNIX shell script?

we are getting files on daily basis.we need to process these files. i need a unix shell script where we can count 1-The no of files processed 2-No of data/record processed for each files. The script should log these details into a database table. If there is any error while file... (3 Replies)
Discussion started by: Atul kumar
3 Replies
MAKE_SOCKDFR(8) 					      System Manager's Manual						   MAKE_SOCKDFR(8)

NAME
make_sockdfr - Generates frozen route file for SOCKS server SYNOPSIS
make_sockdfr [infile [outfile] ] DESCRIPTION
make_sockdfr reads in a plain-text route file for the SOCKS server and produces a frozen route file as the output. Both arguments are optional. The default for infile is /etc/sockd.route; the default for outfile is /etc/sockd.fr. You may specify infile while omitting outfile, but you cannot specify outfile without also speficying infile. The contents of the frozen route file is essentially the memory image of the parsed input file. Using the frozen route file can reduce the start-up delay of the SOCKS server program since it no longer has to parse the file contents. When the SOCKS server starts, it always looks for the frozen route file /etc/sockd.fr first. If that file is not found, it then tries to use the plain-text route file /etc/sockd.route. If you use frozen route file, you must remember to run make_sockdfr every time after you modify the plain-text file or the SOCKS server will continue to use the frozen version of a previous route file. To find out the contents of a frozen route file, use dump_sockdfr. FILES
/etc/sockd.fr, /etc/sockd.route SEE ALSO
dump_sockdfr(8), sockd.fr(5), sockd.route(5) AUTHOR
Ying-Da Lee, yingda@esd.sgi.com or yingda@best.com May 6, 1996 MAKE_SOCKDFR(8)
All times are GMT -4. The time now is 07:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy