Sponsored Content
Top Forums UNIX for Dummies Questions & Answers counting lines and showing the output Post 54097 by jjoves on Monday 2nd of August 2004 01:08:38 PM
Old 08-02-2004
Error counting lines and showing the output

First time poster -

I have a huge file and i want to sort and compress it to something more readable

Ex:
FUTNCA01-SL1 DMT8a4 5 3
FUTNCA01-SL1 DMT8a4 5 9
FUTNCA01-SL1 DMT8a4 5 21
FUTNCA01-SL1 DMT8a4 5 22
FUTNCA01-SL1 DMT8a4 5 23
FUTNCA01-SL1 DMT8a4 5 24
FUTNCA01-SL1 DMT8a4 6 2
FUTNCA01-SL1 DMT8a4 6 3
FUTNCA01-SL1 DMT8a4 6 7
ALBQNMMA-SL1 DMT8a4 3 1
ALBQNMMA-SL1 DMT8a4 3 2
ALBQNMMA-SL1 DMT8a4 3 3
ALBQNMMA-SL1 DMT8a4 3 4
ALBQNMMA-SL1 DMT8a4 12 7


Output 1 desired
FUTNCA01-SL1 DMT8a4 5 6 ---> count of 2nd to the last field
FUTNCA01-SL1 DMT8a4 6 2 --> count of last field
ALBQNMMA-SL1 DMT8a4 3 4
ALBQNMMA-SL1 DMT8a4 12 1

Output 2 desired
FUTNCA01-SL1 DMT8a4 8 --> total number lines
ALBQNMMA-SL1 DMT8a4 5

Last edited by jjoves; 08-02-2004 at 02:40 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with showing the difference in two lines of input

I would like my script to be able to tell the difference between to lines of input, like: Input 1: 1 2 3 4 5 Input 2: 1 2 3 4 5 6 I want the script to tell me that the difference between the two lines is the 6. Is there anyway I can have it do this? Here's an example of what my script... (12 Replies)
Discussion started by: Kweekwom
12 Replies

2. Shell Programming and Scripting

Counting lines for each application

Hi All, I have a output that suppose to be like this (see below please) App : Line counts === ================== AAA: 100 BBB: 201 CCC: 137 DDD: 32 EEE: 55 for i in `ps -ef | grep App`; do print $i; done This only shows App : === (12 Replies)
Discussion started by: Beginer0705
12 Replies

3. Shell Programming and Scripting

Showing the first 4 lines of a file?

Is there a way to show the first 4 lines of a file without using head -4? In sed would it be sed '1,4d' ? What if I just wanted to display the 2nd line ONLY? How could this be done with AWK?...correctly with SED? (6 Replies)
Discussion started by: puttster
6 Replies

4. UNIX for Dummies Questions & Answers

HELP! showing output as a ratio in uniq

Hi, I have the following file called addresses, (it is a large file i have only copy and pasted few of the data below) and I am wanting to write a command so it will Find the ratio of mobile (07....) to land line (01....) telephone numbers? then find the most popular first name and list the... (1 Reply)
Discussion started by: tina_2010
1 Replies

5. UNIX for Dummies Questions & Answers

Counting # of lines

Counting number of lines: sp I am trying to figure out a script to count the number of text files in cywig and have it give me a number (as the answer) any help would be appreciated. I am new here, so be gentle :D (3 Replies)
Discussion started by: unicksjp
3 Replies

6. Solaris

Showing strange size in df output

Hi, This is Solaris-10 box and in few of file-system (root file-system of non global zones), usage/available is not showing correct size. I am not able to figure out, what is eating up this space. Global Server - bdrpod01 Non Global zone - bdrpod01-zputq01 root@bdrpod01:/root# df -h... (2 Replies)
Discussion started by: solaris_1977
2 Replies

7. Shell Programming and Scripting

Now showing the correct output

Hello I am working on one script where I am trying to display all the directories which is inside the workspace but somehow it is giving me weird output and this is occurring only with one directory other also having the result.html file inside the directory. for i in `ls -1 | egrep -iv... (2 Replies)
Discussion started by: anuragpgtgerman
2 Replies

8. UNIX for Dummies Questions & Answers

Command showing no output!

Hi Folks, I have a situation here, where no command is giving any output, and it's not even showing any error message also. What could be the reason? (3 Replies)
Discussion started by: nixhead
3 Replies

9. Shell Programming and Scripting

Script showing incorrect output

Hello scripting geeks, I am new to scripting and facing some issues in writing the logic of the script. Request your kind help here Actually when i run a command i get o/p as below o/p : 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 these are hex values i guess...now i want to... (15 Replies)
Discussion started by: kulvant29
15 Replies

10. Shell Programming and Scripting

Pgrep not showing desired output

I am searching for a process that should be up and running. Im using the following command ps -ef | grep elasticsearch to get elastic+ 1673 1 0 Jan29 ? 05:08:56 /bin/java -Xms4g -Xmx4g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC... (1 Reply)
Discussion started by: Junaid Subhani
1 Replies
PERLMPEIX(1)						 Perl Programmers Reference Guide					      PERLMPEIX(1)

NAME
README.mpeix - Perl/iX for HP e3000 MPE SYNOPSIS
http://www.bixby.org/mark/perlix.html http://jazz.external.hp.com/src/hp_freeware/perl/ Perl language for MPE Last updated June 2, 2000 @ 0400 UTC NOTE
This is a podified version of the above-mentioned web page, podified by Jarkko Hietaniemi 2001-Jan-01. Binary distribution from HP The simplest way to obtain Perl for the MPE/iX is to go either of these URLs and follow the instructions within. http://jazz.external.hp.com/src/hp_freeware/perl/ http://www.bixby.org/mark/perlix.html Use which ever one is more recent. What's New in Perl for MPE/iX June 1, 2000 o Rebuilt to be compatible with mod_perl. If you plan on using mod_perl, you MUST download and install this version of Perl/iX! o uselargefiles="undef": not available in MPE for POSIX files yet. o Now bundled with various add-on packages: o libnet (as seen on CPAN) o libwww-perl (LWP) which lets Perl programs behave like web browsers: 1. #!/PERL/PUB/perl 2. use LWP::Simple; 3. $doc = get('http://www.bixby.org/mark/perlix.html'); # reads the web page into variable $doc (http://www.bixby.org/mark/perlix.html) o mod_perl (just the perl portion; the actual DSO will be released soon with Apache/iX 1.3.12 from bixby.org). This module allows you to write high performance persistent Perl CGI scripts and all sorts of cool things. (http://perl.apache.org/) and much much more hiding under /PERL/PUB/.cpan/ o The CPAN module now works for automatic downloading and installing of add-on packages: 1. export FTP_PASSIVE=1 2. perl -MCPAN -e shell 3. Ignore any terminal I/O related complaints! (http://theoryx5.uwinnipeg.ca/CPAN/data/perl/CPAN.html) May 20, 2000 o Updated to version 5.6.0. Builds straight out of the box on MPE/iX. o Perl's getpwnam() function which had regressed to being unimplemented on MPE is now implemented once again. September 17, 1999 o Migrated from cccd.edu to bixby.org. Welcome to Perl/iX This is the official home page for the HP e3000 MPE/iX ( http://www.hp.com/go/e3000 ) port of the Perl scripting language ( http://www.perl.com/ ) which gives you all of the power of C, awk, sed, and sh in a single language. Check here for the latest news, imple- mented functionality, known bugs, to-do list, etc. Status reports about major milestones will also be posted to the HP3000-L mailing list ( http://www.lsoft.com/scripts/wl.exe?SL1=HP3000-L&H=RAVEN.UTC.EDU ) and its associated gatewayed newsgroup comp.sys.hp.mpe. I'm doing this port because I can't live without Perl on the Unix machines that I administer, and I want to have the same power available to me on MPE. Please send your comments, questions, and bug reports directly to me, Mark Bixby ( http://www.bixby.org/mark/ ), by e-mailing to mark@bixby.org. Or just post them to HP3000-L. The platform I'm using to do this port is an HP 3000 957RX running MPE/iX 6.0 and using the GNU gcc C compiler ( http://jazz.exter- nal.hp.com/src/gnu/gnuframe.html ). The combined porting wisdom from all of my ports can be found in my MPE/iX Porting Guide (http://www.bixby.org/mark/porting.html). IMPORTANT NOTICE: Yes, I do work for the HP CSY R&D lab, but ALL of the software you download from bixby.org is my personal freeware that is NOT supported by HP. System Requirements for Perl/iX o MPE/iX 5.5 or later. This version of Perl/iX does NOT run on MPE/iX 5.0 or earlier, nor does it run on "classic" MPE/V machines. o If you wish to recompile Perl, you must install both GNUCORE and GNUGCC from jazz (http://jazz.external.hp.com/src/gnu/gnuframe.html). o Perl/iX will be happier on MPE/iX 5.5 if you install the MPEKX40B extended POSIX filename characters patch, but this is optional. o Patch LBCJXT6A is required on MPE/iX 5.5 machines in order to prevent Perl/iX from dying with an unresolved external reference to _getenv_libc. o If you will be compiling Perl/iX yourself, you will also need Syslog/iX ( http://www.bixby.org/mark/syslogix.html ) and the /BIND/PUB/include and /BIND/PUB/lib portions of BIND/iX ( http://www.bixby.org/mark/bindix.html ). How to Obtain Perl/iX 1. Download Perl using either FTP.ARPA.SYS or some other client 2. Extract the installation script 3. Edit the installation script 4. Run the installation script 5. Convert your *.a system archive libraries to *.sl shared libraries Download Perl using FTP.ARPA.SYS from your HP 3000 (the preferred method)..... :HELLO MANAGER.SYS :XEQ FTP.ARPA.SYS open ftp.bixby.org anonymous your@email.address bytestream cd /pub/mpe get perl-5.6.0-mpe.tar.Z /tmp/perl.tar.Z;disc=2147483647 exit .....Or download using some other generic web or ftp client (the alternate method) Download the following files (make sure that you use "binary mode" or whatever client feature that is 8-bit clean): o Perl from http://www.bixby.org/ftp/pub/mpe/perl-5.6.0-mpe.tar.Z or ftp://ftp.bixby.org/pub/mpe/perl-5.6.0-mpe.tar.Z o Upload those files to your HP 3000 in an 8-bit clean bytestream manner to: /tmp/perl.tar.Z o Then extract the installation script (after both download methods) :CHDIR /tmp :XEQ TAR.HPBIN.SYS 'xvfopz /tmp/perl.tar.Z INSTALL' o Edit the installation script Examine the accounting structure creation commands and modify if necessary (adding additional capabilities, choosing a non-system vol- ume set, etc). :XEQ VI.HPBIN.SYS /tmp/INSTALL o Run the installation script. The accounting structure will be created and then all files will be extracted from the archive. :XEQ SH.HPBIN.SYS /tmp/INSTALL o Convert your *.a system archive libraries to *.sl shared libraries You only have to do this ONCE on your MPE/iX 5.5 machine in order to convert /lib/lib*.a and /usr/lib/lib*.a libraries to their *.sl equivalents. This step should not be necessary on MPE/iX 6.0 or later machines because the 6.0 or later update process does it for you. :XEQ SH.HPBIN.SYS /PERL/PUB/LIBSHP3K Perl/iX Distribution Contents Highlights README The file you're reading now. INSTALL Perl/iX Installation script. LIBSHP3K Script to convert *.a system archive libraries to *.sl shared libraries. PERL Perl NMPRG executable. A version-numbered backup copy also exists. You might wish to "ln -s /PERL/PUB/PERL /usr/local/bin/perl". .cpan/ Much add-on source code downloaded with the CPAN module. lib/ Perl libraries, both core and add-on. man/ Perl man page documentation. public_html/feedback.cgi Sample feedback CGI form written in Perl. src/perl-5.6.0-mpe Source code. How to Compile Perl/iX 1. cd src/perl-5.6.0-mpe 2. Read the INSTALL file for the official instructions 3. ./Configure -d 4. make 5. ./mpeix/relink 6. make test (expect approximately 15 out of 11306 subtests to fail, mostly due to MPE not supporting hard links, UDP socket problems, and handling exit() return codes improperly) 7. make install 8. Optionally create symbolic links that point to the Perl executable, i.e. ln -s /PERL/PUB/PERL /usr/local/bin/perl The summary test results from "cd t; ./perl -I../lib harness": Failed Test Status Wstat Total Fail Failed List of failed --------------------------------------------------------------------------- io/fs.t 29 8 27.59% 2-5, 7-9, 11 io/openpid.t 10 1 10.00% 7 lib/io_sock.t 14 1 7.14% 13 lib/io_udp.t 7 2 28.57% 3, 5 lib/posix.t 27 1 3.70% 12 op/lex_assign.t 187 1 0.53% 13 op/stat.t 58 1 1.72% 3 15 tests and 94 subtests skipped. Failed 7/236 test scripts, 97.03% okay. 15/11306 subtests failed, 99.87% okay. Getting Started with Perl/iX Create your Perl script files with "#!/PERL/PUB/perl" (or an equivalent symbolic link) as the first line. Use the chmod command to make sure that your script has execute permission. Run your script! Be sure to take a look at the CPAN module list ( http://www.cpan.org/CPAN.html ). A wide variety of free Perl software is available. You can automatically download these packages by using the CPAN module ( http://theoryx5.uwinnipeg.ca/CPAN/data/perl/CPAN.html ). MPE
/iX Implementation Considerations There some minor functionality issues to be aware of when comparing Perl for Unix (Perl/UX) to Perl/iX: o MPE gcc/ld doesn't properly support linking NMPRG executables against NMXL dynamic libraries, so you must manually run mpeix/relink after each re-build of Perl. o Perl/iX File::Copy will use MPE's /bin/cp command to copy files by name in order to preserve file attributes like file code. o MPE (and thus Perl/iX) lacks support for setgrent(), endgrent(), setpwent(), endpwent(). o MPE (and thus Perl/iX) lacks support for hard links. o MPE requires GETPRIVMODE() in order to bind() to ports less than 1024. Perl/iX will call GETPRIVMODE() automatically on your behalf if you attempt to bind() to these low-numbered ports. Note that the Perl/iX executable and the PERL account do not normally have CAP=PM, so if you will be bind()-ing to these privileged ports, you will manually need to add PM capability as appropriate. o MPE requires that you bind() to an IP address of zero. Perl/iX automatically replaces the IP address that you pass to bind() with a zero. o If you use Perl/iX fcntl() against a socket it will fail, because MPE requires that you use sfcntl() instead. Perl/iX does not presently support sfcntl(). o MPE requires GETPRIVMODE() in order to setuid(). There are too many calls to setuid() within Perl/iX, so I have not attempted an auto- matic GETPRIVMODE() solution similar to bind(). Known Perl/iX Bugs Under Investigation None. Perl/iX To-Do List o Make setuid()/setgid() support work. o Make sure that fcntl() against a socket descriptor is redirected to sfcntl(). o Add support for Berkeley DB once I've finished porting Berkeley DB. o Write an MPE XS extension library containing miscellaneous important MPE functions like GETPRIVMODE(), GETUSERMODE(), and sfcntl(). Perl/iX Change History May 6, 1999 o Patch LBCJXT6A is required on MPE/iX 5.5 machines in order to prevent Perl/iX from dying with an unresolved external reference to _getenv_libc. April 7, 1999 o Updated to version 5.005_03. o The official source distribution once again compiles "straight out of the box" for MPE. o The current incarnation of the 5.5 POSIX filename extended characters patch is now MPEKX40B. o The LIBSHP3K *.a -> *.sl library conversion script is now included as /PERL/PUB/LIBSHP3K. November 20, 1998 o Updated to version 5.005_02. o Fixed a DynaLoader bug that was unable to load symbols from relative path name libraries. o Fixed a .xs compilation bug where the mpeixish.sh include file wasn't being installed into the proper directory. o All bugfixes will be submitted back to the official Perl developers. o The current incarnation of the POSIX filename extended characters patch is now MPEKXJ3A. August 14, 1998 o The previous POSIX filename extended characters patch MPEKX44C has been superseded by MPEKXB5A. August 7, 1998 o The previous POSIX filename extended characters patch MPEKX76A has been superseded by MPEKX44C. July 28, 1998 o Updated to version 5.005_01. July 23, 1998 o Updated to version 5.005 (production release). The public freeware sources are now 100% MPE-ready "straight out of the box". July 17, 1998 o Updated to version 5.005b1 (public beta release). The public freeware sources are now 99.9% MPE-ready. By installing and testing this beta on your own HP3000, you will be helping to insure that the final release of 5.005 will be 100% MPE-ready and 100% bug free. o My MPE binary release is now extracted using my standard INSTALL script. July 15, 1998 o Changed startperl to #!/PERL/PUB/perl so that Perl will recognize scripts more easily and efficiently. July 8, 1998 o Updated to version 5.004_70 (internal developer release) which is now MPE-ready. The next public freeware release of Perl should com- pile "straight out of the box" on MPE. Note that this version of Perl/iX was strictly internal to me and never publicly released. Note that [21]BIND/iX is now required (well, the include files and libbind.a) if you wish to compile Perl/iX. November 6, 1997 o Updated to version 5.004_04. No changes in MPE-specific functionality. October 16, 1997 o Added Demos section to the Perl/iX home page so you can see some sample Perl applications running on my 3000. October 3, 1997 o Added System Requirements section to the Perl/iX home page just so the prerequisites stand out more. Various other home page tweaks. October 2, 1997 o Initial public release. September 1997 o Porting begins. AUTHOR
Mark Bixby, mark@bixby.org perl v5.8.0 2003-02-18 PERLMPEIX(1)
All times are GMT -4. The time now is 08:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy