05-05-2012
count number of entries perl program or Unix script
Hi
I have a file with number of entries
name 1 123
name 1 345
name 1 65346
name2 3243
name2 24234
name 2 234234
so on .........
how to count total number of entries for name 1 and name2...and so on Please guide.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i want to count the number of character contained in afile using perl cript help me out (1 Reply)
Discussion started by: trupti_rinku
1 Replies
2. Shell Programming and Scripting
Hi all
i have a unix script reformatter.sh
i have a process whereby this script reformats a file before a perl program is used to update it
i am having a little problem automating the entire process . is there a way whereby i can call the unix script from the perl program ? (12 Replies)
Discussion started by: dwightja24
12 Replies
3. UNIX for Dummies Questions & Answers
Hey all,
I'm looking for a command that will search a directory (and all subdirectories) and give me a file count for the number of files that contain specific characters within its filename. e.g. I want to find the number of files that contain "-a.jpg" in their name.
All the searching I've... (6 Replies)
Discussion started by: murphysm
6 Replies
4. Shell Programming and Scripting
how to count the total number of lines of all the files under a directory using perl script..
I mean if I have 10 files under a directory then I want to count the total number of lines of all the 10 files contain. Please help me in writing a perl script on this. (5 Replies)
Discussion started by: adityam
5 Replies
5. Shell Programming and Scripting
Hi,
I have a file (movies.sh), this file contains list of movies such as
I want to redirect the movies from movies.sh to file_to_process to allow me process the file with out losing anything.
I have tried
Movies.sh >> file_to_process
But I want to add the row number to the data... (2 Replies)
Discussion started by: INHF
2 Replies
6. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Write a shell script program to count the ONLY the number of alphabetic characters stored in the shell variable... (1 Reply)
Discussion started by: kofine05
1 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I need a solaris shell script to read multiple files and count number of unique name rows(strings) from those files. The input and output should be like this
Input:
file 1
abc
cde
abc ... (9 Replies)
Discussion started by: ssk250
9 Replies
8. UNIX for Dummies Questions & Answers
I have a folder named test/ and under that I have multiple directories and in each of the directory I have multiple log files. I want to know how many files exists under each sub directory.
test
|--quanrantine
|--logfile1
|--logfile2
|--spooling
|--logfile1
... (4 Replies)
Discussion started by: ravikirankethe
4 Replies
9. AIX
This question is asked in an interview today that I have to return output with each PID number and the count of each PID number logged today. Here is the script that I have written. Can you confirm if that would work or not. The interviewer didn't said if my answer is correct or not. Can someone... (5 Replies)
Discussion started by: Subodh Kumar
5 Replies
10. UNIX for Beginners Questions & Answers
Hello All,
I am looking to write a script to count the number of a term and its opposite and create a new file with said list. I can get the terms to print to the file but only one or the other and not both.
I tried this:
grep -wi done */all.txt | grep -wiv done */all.txt > "filename"
... (5 Replies)
Discussion started by: mcesmcsc
5 Replies
LEARN ABOUT OPENSOLARIS
symlink
symlink(2) System Calls symlink(2)
NAME
symlink - make a symbolic link to a file
SYNOPSIS
#include <unistd.h>
int symlink(const char *name1, const char *name2);
DESCRIPTION
The symlink() function creates a symbolic link name2 to the file name1. Either name may be an arbitrary pathname, the files need not be on
the same file system, and name1 may be nonexistent.
The file to which the symbolic link points is used when an open(2) operation is performed on the link. A stat() operation performed on a
symbolic link returns the linked-to file, while an lstat() operation returns information about the link itself. See stat(2). Unexpected
results may occur when a symbolic link is made to a directory. To avoid confusion in applications, the readlink(2) call can be used to read
the contents of a symbolic link.
RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned, errno is set to indicate the error, and the symbolic link is not
made.
ERRORS
The symlink() function will fail if:
EACCES Search permission is denied for a component of the path prefix of name2.
EDQUOT The directory where the entry for the new symbolic link is being placed cannot be extended because the user's quota of disk
blocks on that file system has been exhausted; the new symbolic link cannot be created because the user's quota of disk
blocks on that file system has been exhausted; or the user's quota of inodes on the file system where the file is being
created has been exhausted.
EEXIST The file referred to by name2 already exists.
EFAULT The name1 or name2 argument points to an illegal address.
EILSEQ The path argument includes non-UTF8 characters and the file system accepts only file names where all characters are part of
the UTF-8 character codeset.
EIO An I/O error occurs while reading from or writing to the file system.
ELOOP Too many symbolic links are encountered in translating name2.
ENAMETOOLONG The length of the name2 argument exceeds PATH_MAX, or the length of a name2 component exceeds NAME_MAX while
_POSIX_NO_TRUNC is in effect.
ENOENT A component of the path prefix of name2 does not exist.
ENOSPC The directory in which the entry for the new symbolic link is being placed cannot be extended because no space is left on
the file system containing the directory; the new symbolic link cannot be created because no space is left on the file sys-
tem which will contain the link; or there are no free inodes on the file system on which the file is being created.
ENOSYS The file system does not support symbolic links.
ENOTDIR A component of the path prefix of name2 is not a directory.
EROFS The file name2 would reside on a read-only file system.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO
cp(1), link(2), open(2), readlink(2), stat(2), unlink(2), attributes(5)
SunOS 5.11 18 May 2007 symlink(2)