07-30-2009
How about:
wc -c < /etc/passwd which will increase performance more than either by avoiding awk entirely.
Or even stat -c '%s' /etc/passwd which only checks the file size instead of actually reading the entire thing.
Last edited by Corona688; 07-30-2009 at 06:11 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all you enlightened unix people,
I've been trying to execute a perl script that contains the following line within backticks:
`grep -f patternfile.txt otherfile.txt`;It takes normally 2 minutes to execute this command from the bash shell by hand.
I noticed that when i run this command... (2 Replies)
Discussion started by: silverlocket
2 Replies
2. Shell Programming and Scripting
Hi,
A datafile containing lines such as below needs to be split:
500000000000932491683600000000000000000000000000016800000GS0000000000932491683600*HOME
I need to get the 2-5, 11-20, and 35-40 characters and I can do it via cut command.
cut -c 2-5 file > temp1.txt
cut -c 11-20 file >... (9 Replies)
Discussion started by: daytripper1021
9 Replies
3. Shell Programming and Scripting
I'm sorting files from a source directory by size into 4 categories then copying them into 4 corresponding folders, just wondering if there's a faster/better/more_elegant way to do this:
find /home/user/sourcefiles -type f -size -400000k -exec /bin/cp -uv {} /home/user/medfiles/ \;
find... (0 Replies)
Discussion started by: unclecameron
0 Replies
4. HP-UX
we have 30 GB files on our filesystem which we need to copy daily to 25 location on the same machine (but different filesystem).
cp is taking 20 min to do the copy and we have 5 different thread doing the copy.
so in all its taking around 2 hr and we need to reduce it.
Is there any... (9 Replies)
Discussion started by: shipra_31
9 Replies
5. Shell Programming and Scripting
Hi,
I have a script below for extracting xml from a file.
for i in *.txt
do
echo $i
awk '/<.*/ , /.*<\/.*>/' "$i" | tr -d '\n'
echo -ne '\n'
done
.
I read about using multi threading to speed up the script.
I do not know much about it but read it on this forum.
Is it a... (21 Replies)
Discussion started by: chetan.c
21 Replies
6. Shell Programming and Scripting
awk "/May 23, 2012 /,0" /var/tmp/datafile
the above command pulls out information in the datafile. the information it pulls is from the date specified to the end of the file.
now, how can i make this faster if the datafile is huge? even if it wasn't huge, i feel there's a better/faster way to... (8 Replies)
Discussion started by: SkySmart
8 Replies
7. UNIX for Dummies Questions & Answers
Hello guys,
I'm cleaning out big XML files (we're talking about 1GB at least), most of them contain words written in a non-latin alphabet.
The command I'm using is so slow it's not even funny:
cat $1 | sed -e :a -e 's/<*>//g;/</N;//ba;s/</ /g;s/>/... (4 Replies)
Discussion started by: bobylapointe
4 Replies
8. Shell Programming and Scripting
Hi,
I have a large number of input files with two columns of numbers.
For example:
83 1453
99 3255
99 8482
99 7372
83 175
I only wish to retain lines where the numbers fullfil two requirements. E.g:
=83
1000<=<=2000
To do this I use the following... (10 Replies)
Discussion started by: s052866
10 Replies
9. Shell Programming and Scripting
Good evening
Im new at unix shell scripting and im planning to script a shell that removes headers for about 120 files in a directory and each file contains about 200000
lines in average.
i know i will loop files to process each one and ive found in this great forum different solutions... (5 Replies)
Discussion started by: alexcol
5 Replies
10. Shell Programming and Scripting
I have the below command which is referring a large file and it is taking 3 hours to run. Can something be done to make this command faster.
awk -F ',' '{OFS=","}{ if ($13 == "9999") print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12 }' ${NLAP_TEMP}/hist1.out|sort -T ${NLAP_TEMP} |uniq>... (13 Replies)
Discussion started by: Peu Mukherjee
13 Replies
LEARN ABOUT REDHAT
mknetid
MKNETID(8) Reference Manual MKNETID(8)
NAME
mknetid - generate data for netid map
SYNOPSIS
/usr/lib/yp/mknetid [ -q ] [ -h hosts ] [ -p passwd ] [ -g group ] [ -d domain ] [ -n netid ]
/usr/lib/yp/mknetid --version
DESCRIPTION
mknetid generates the netid.byname NIS map from the contents of the group(5), passwd(5), hosts(5) and netid files. It checks for multiple
entrys of netids and warn for them or filters them out. It is only called by /var/yp/Makefile when rebuilding the NIS map.
OPTIONS
-q This flag turns on 'quiet' mode, don't print a warning message when finding an duplicate netid entry.
-h hosts
The -h flag can be used to specify the use of another hosts file than the default /etc/hosts.
-p passwd
The -p flag can be used to specify the use of another passwd file than the default /etc/passwd.
-g group
The -g flag can be used to specify the use of another group file than the default /etc/group.
-n netid
The -n flag can be used to specify the use of another netid file than the default /etc/netid.
-d domain
The mknetid command uses the system domainname by default. If it is not set or you whish to override it, you must use the -d parame-
ter.
--version
Prints the version number
FILES
/etc/group groups file
/etc/hosts hosts database
/etc/netid netname database
/etc/passwd password file
SEE ALSO
passwd(8), group(5), hosts(5), passwd(5)
AUTHOR
mknetid was written by Thorsten Kukuk <kukuk@suse.de>.
YP Server August 2001 MKNETID(8)