Sponsored Content
Full Discussion: Problem to read archive
Top Forums Shell Programming and Scripting Problem to read archive Post 302368135 by rdcwayx on Wednesday 4th of November 2009 07:15:27 AM
Old 11-04-2009
Code:
$ cat file.txt |awk '{print $3}'  |sort |uniq -c |sort  -k2 |awk '{print $2"_file.txt with",$1, "records"}'
02_file.txt with 3 records
06_file.txt with 2 records
08_file.txt with 1 records
09_file.txt with 1 records

Code:
$ awk '{a[$3]+=1} END {for (i in a) print i"_file.txt with",a[i],"records" }' file.txt  |sort
02_file.txt with 3 records
06_file.txt with 2 records
08_file.txt with 1 records
09_file.txt with 1 records


Last edited by rdcwayx; 11-04-2009 at 08:27 AM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read from file then purge or archive.

Hi All, I have a root directory /tmp and I want to purge files or archive files in its subsequent subfolders.I listed the path of files I want to purge(archive) and the #of days. (purge) DAYS PATH 7 /tmp/arsenal/* 5 /tmp/chelsea/* (archive? the same as above but different folders... (15 Replies)
Discussion started by: kayarsenal
15 Replies

2. Shell Programming and Scripting

read list of filenames from text file, archive, and remove

I posted a week ago regarding this scripting question, but I need to revisit and have a few more questions answered.. User cfajohnson was extremely helpful with the archive script, but clarification on my part is needed to help steer the answer in a direction that works in this particular... (5 Replies)
Discussion started by: fxvisions
5 Replies

3. Solaris

problem in creating flash archive

Dear all I am in a problem. I have created a master server on which I have install a Solaris 10 OS as well as Oracle 10g with some additional solaris packages. Now I want to create a flash archive of this server and install that flash archive on another server, so that the new server will have... (6 Replies)
Discussion started by: girish.batra
6 Replies

4. Shell Programming and Scripting

Read specific file from a zip archive without extracting

Hi All, I would like to extract specific file from a zip archive. I have a zip archive "sample.zip". sample.zip contains few text files and images... text1.txt, text2.txt, pic.jpg etc... I need to read specific file "text2.txt" from "sample.zip" WITHOUT EXTRACTING the zip file. ... (4 Replies)
Discussion started by: sridharg
4 Replies

5. Programming

read file from tar.gz archive

I want to write a c-program which reads a textfile from a tar.gz archive. How can I do it? (9 Replies)
Discussion started by: krylin
9 Replies

6. Shell Programming and Scripting

Archive::Tar problem

Hello, I have a problem using Archive::Tar. it seem very trivial but i cannot get it work. First I have a list of files I grab from a directory. Then I create a tar archive and write the files into the archive. everything works great, except that I cannot properly extract the files. What... (0 Replies)
Discussion started by: amcrisan
0 Replies

7. Shell Programming and Scripting

Extracting from archive | compressing to new archive

Hi there, I have one huge archive (it's a system image). I need sometime to create smaller archives with only one or two file from my big archive. So I'm looking for a command that extracts files from an archive and pipe them to another one. I tried the following : tar -xzOf oldarchive.tgz... (5 Replies)
Discussion started by: chebarbudo
5 Replies

8. Solaris

Boot-archive Problem

I disabled the boot-archive service by using #svcadm disable svc:/system/boot-archive:default then i rebooted my system but i am unable to boot. It throws the following errors CONSOLE LOGIN SERVICE(S) CANNOT RUN then it automatically asked me for the maintenance mode passwd. i logged... (3 Replies)
Discussion started by: dinu
3 Replies

9. Shell Programming and Scripting

Script to archive logs and sftp to another archive server

Requirement: Under fuse application we have placeholders called containers; Every container has their logs under: <container1>/data/log/fuse.log <container1>/data/log/fuse.log.1 <container1>/data/log/fuse.log.XX <container2>/data/log/fuse.log... (6 Replies)
Discussion started by: Arjun Goswami
6 Replies
elf_rand(3E)															      elf_rand(3E)

NAME
elf_rand - random archive member access SYNOPSIS
[flag... ] file... [library] ... DESCRIPTION
and manipulate simple object files and archives. elf is an ELF descriptor previously returned from provides random archive processing, preparing elf to access an arbitrary archive member. elf must be a descriptor for the archive itself, not a member within the archive. offset gives the byte offset from the beginning of the archive to the archive header of the desired mem- ber. See elf_getarsym(3E) for more information about archive member offsets. When works, it returns offset. Otherwise it returns 0, because an error occurred, elf was null, or the file was not an archive (no archive member can have a zero offset). A program may mix ran- dom and sequential archive processing. EXAMPLES
An archive starts with a ``magic string'' that has bytes; the initial archive member follows immediately. An application could thus pro- vide the following function to rewind an archive (the function returns -1 for errors and 0 otherwise). #include <ar.h> #include <libelf.h> int rewindelf(Elf *elf) { if (elf_rand(elf, (size_t)SARMAG) == SARMAG) return 0; return -1; } SEE ALSO
ar(4), elf(3E), elf_begin(3E), elf_getarsym(3E), elf_next(3E). elf_rand(3E)
All times are GMT -4. The time now is 02:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy