02-16-2007
formatting a file headache
Hello does anyone know how to do the following using some simple unix if possible:
I have a file with the following info as comma separated. It shows username, id number and all the subjects they are enrolled in on the one line. The subjects are separated by colons.
UserName,ID,Subject
jsmith,235456939,MATH29879:PHYS45979
jdoe,750378929,ENGL36899:JAPN92576
I need it to have just one course per user line per user. So that it would look like:
jsmith,235456939,MATH29879
jsmith,235456939,PHYS45979
jdoe,750378929,ENGL36899
jdoe,750378929,JAPN92576
Does anyone have any ideas? I'm pulling my hair out!
Thnx
-J
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I need to execute command at remote host from my program.
there is rs6000/aix standard command called rexec.
unfortunately rexec ask username and password which must supplied interactively, of course it is impossible runned by program.
So I have to change rexec command format to make user-name... (5 Replies)
Discussion started by: yatno
5 Replies
2. IP Networking
Hi all,
I upgraded my SUSE 6.1 to SUSE 7.1 and at once the following things won't work anymore:
1) My DHCP client is not able anymore to retrieve my IP address from the @home server. It times out all the time. If I use a fixed IP I can get on the net, so there is no physical problem.
2) I... (3 Replies)
Discussion started by: Micky
3 Replies
3. Solaris
guys, need your help~~~~
I am setting up a Sun Enterprise 450 Ultra 4 server
originally I was using Sun solaris 9 1202 version.
but after an accident (i guess becoz i deleted something wrongly), the system cannot boot up.
and now I wana install a FreeBSD(since it is free and it will... (3 Replies)
Discussion started by: MrDJay
3 Replies
4. Shell Programming and Scripting
I've still a little problem with sed.
So, the content of my file.txt is like:
101.10.20.2.1079 > 101.11.2.20.80:
101.10.20.2.1080 > 101.11.2.20.80:
101.10.20.2.1081 > 101.10.20.2..80:
101.05.15.143.1068 > tpo68-96-22-1.no.no.cox.net.4391:
101.05.15.143.1072 >... (5 Replies)
Discussion started by: nymus7
5 Replies
5. UNIX for Dummies Questions & Answers
Hi all,
I've got a thorny sed/regex problem and I thought somebody out there might be able to help.
I'd like to use sed in a Makefile to parse a path string. The path might look like this:
case 1: /mnt/users/bob/build/src
or
case 2: /mnt/users/bob/build/src/foo
or
case 3: ... (4 Replies)
Discussion started by: gnarl
4 Replies
6. Shell Programming and Scripting
Surely there's an easier way to do this, lets see if anyone knows! I am new to scripting so go easy on me!
I have the following script and at the moment it doesn't work and I believe the problem is that I am using a while loop within a while loop. When I run the script using sh -x I can see... (6 Replies)
Discussion started by: StevePace
6 Replies
7. Shell Programming and Scripting
Hi all,
It's been a long week and my brain is clearly not functioning right so hopefully someone can help me out here.
I've got a function in a script which just checks if a MySQL database directory exists or not. Code is as follows:
dbCheck2() {
if ;
then {
:
# carry... (4 Replies)
Discussion started by: _Spare_Ribs_
4 Replies
8. UNIX for Advanced & Expert Users
Good day,
I am trying to run a ssh command on a remote server, but when I run the command the server takes FOREVER... and ends up giving me an error..
then the script also kicks server load up by 100% while it is running..
But if I run the same command on the server it goes pretty quickly and... (3 Replies)
Discussion started by: msullivan
3 Replies
9. Shell Programming and Scripting
I have to write a program to read data from files and then format into another file. However, I face a strange problem related to control character that I can't understand and solve.
The source file is compose of many lines with such format:
T_NAME|P_NAME|P_CODE|DOCUMENT_PATH|REG_DATE
... (3 Replies)
Discussion started by: hk6279
3 Replies
10. Shell Programming and Scripting
Hi,
I am new to shell scripting, but doing my best to learn things. Today doing courses there was exercise like this:
#!/usr/bin/bash
a=$1
b=$2
if ]
then
echo "Conditions are met"
else
echo "Conditions are not met"
fi
I improved it a little, beacuse of curiosity :D to this:
... (8 Replies)
Discussion started by: Rosentine
8 Replies
LEARN ABOUT MOJAVE
dscacheutil
dscacheutil(1) BSD General Commands Manual dscacheutil(1)
NAME
dscacheutil -- gather information, statistics and initiate queries to the Directory Service cache.
SYNOPSIS
dscacheutil -h
dscacheutil -q category [-a key value]
dscacheutil -cachedump [-buckets] [-entries [category]]
dscacheutil -configuration
dscacheutil -flushcache
dscacheutil -statistics
DESCRIPTION
dscacheutil does various operations against the Directory Service cache including gathering statistics, initiating lookups, inspection, cache
flush, etc. This tool replaces most of the functionality of the lookupd tool previously available in the OS.
FLAGS
A list of flags and their descriptions:
-h Lists the options for calling dscacheutil
-q category
Initiate a query using standard calls. These calls will either return results from the cache or go fetch live data and place them in
the cache. By default if no specific query is requested via -a then all results within that category will be returned.
-a key value
Optional flag to -q for a specific key with a value.
-cachedump
Dumps an overview of the cache by default. Additional flags will provide more detailed information.
-buckets
Used in conjunction with -cachedump to also print hash bucket usage of the current cache.
-entries [category]
Used in conjunction with -cachedump to dump detailed information about cache entries. An optional category can be supplied to only
see types of interest. Dumping 'host' entries can only be done by administrative users.
-configuration
Prints current configuration information, such as the search policy from Directory Service and cache parameters.
-flushcache
Flushes the entire cache. This should only be used in extreme cases. Validation information is used within the cache along with
other techniques to ensure the OS has valid information available to it.
-statistics
Prints statistics from the cache including an overview and detailed call statistics. Some calls are not cached but are derived from
other calls internally. Cache hits and cache misses may not always be equal to external calls. For example getaddrinfo is actually
a combination of gethostbyname with other calls internally to the cache to maximize cache hit rate.
Available categories and associated keys:
group name or gid
host name or ip_address (used for both IPv6 and IPv4)
mount name
protocol name or number
rpc name or number
service name or port
user name or uid
EXAMPLES
Lookup a user:
% dscacheutil -q user -a name jdoe
name: jdoe
password: ********
uid: 501
gid: 501
dir: /Users/jdoe
shell: /bin/csh
gecos: John Doe
Lookup all users:
% dscacheutil -q user
Dump cache overview:
% dscacheutil -cachedump
Dump cache details with user entries:
% dscacheutil -cachedump -entries user
SEE ALSO
DirectoryService(8), dsmemberutil(1)
Darwin Jan 14, 2007 Darwin