The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
create group in unix senthil_is Shell Programming and Scripting 2 12-10-2007 04:18 AM
Monkcast #12: IBM HW group OEMs Solaris to chagrin of SW group & a ... - ZDNet.com bl iBot UNIX and Linux RSS News 0 08-17-2007 04:30 PM
UNIX log to check group creator? newbit UNIX for Dummies Questions & Answers 3 02-07-2006 11:11 AM
listing members of a unix group ovaska UNIX for Dummies Questions & Answers 2 03-09-2005 05:54 PM
how to define permission of unix group mncapara UNIX for Dummies Questions & Answers 3 10-16-2002 09:00 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-04-2007
sureshg_sampat sureshg_sampat is offline
Registered User
  
 

Join Date: Nov 2006
Location: Czech Republic
Posts: 48
Achieving group by logic via Unix

HI friends,

select count(*),country_code from employees_table group by country_code having com_country_code in ("US","UK")

CAn we have an equivalent command in Unix to achieve this

Thanks in advance
Suresh
  #2 (permalink)  
Old 09-04-2007
ranj@chn ranj@chn is offline Forum Advisor  
Playing with Ubuntu Now!
  
 

Join Date: Oct 2005
Location: Chennai
Posts: 365
Purpose?

What is the purpose and what are you trying to achieve? Could you be a little more clear on what you need?
Quote:
Fyi, awk can be used.
  #3 (permalink)  
Old 09-04-2007
cskumar cskumar is offline
Registered User
  
 

Join Date: Oct 2005
Posts: 67
Try this

For Eg:
File
------
US|A
US|B
US|C
UK|1
UK|2

awk 'BEGIN { FS=OFS=SUBSEP="|"}{arr[$1]++ }END {for (i in arr) print i,arr[i]}' File

awk 'BEGIN { FS=OFS=SUBSEP="|"}{arr[$1,$2]++ }END {for (i in arr) print i,arr[i]}' File

regards,
cskumar
  #4 (permalink)  
Old 09-04-2007
donovan donovan is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 7
Sorry for my intrusion but i dont know how to start a thread

Hi Guy`s I`m a newbie to Unix and I`m starting to love it

I got stuck donig backups of tar files to tape

I use this to find all tar files
find . -name '*.tar.*' > output
in output there would be n of file eg. 6
the size output is 156 but tar files are:
9.3M Jul 18 09:48 arch_done_032007.tar.gz
25M Jul 18 09:53 arch_done_042007.tar.gz
67M Jul 18 10:01 arch_done_052007.tar.gz
192M Jul 18 10:27 arch_done_062007.tar.gz
291M Aug 2 11:05 arch_done_072007.tar.gz
544M Sep 3 12:05 arch_done_082007.tar.gz
I then tar output to tape using this command
tar -cvf /dev/rmt/0 output
response is
a 2.0K Sep 3 18:47 output

can you please help me on this matter

thanks donovan
  #5 (permalink)  
Old 09-04-2007
sureshg_sampat sureshg_sampat is offline
Registered User
  
 

Join Date: Nov 2006
Location: Czech Republic
Posts: 48
Achieving group by logic via Unix

Thank you very much for the solution.

I would appreciate more solutions in this regard ..if any

Thanks
  #6 (permalink)  
Old 09-04-2007
ajcannon ajcannon is offline
Registered User
  
 

Join Date: Aug 2007
Location: Binfield, Berkshire. UK
Posts: 91
Not quite right

Quote:
Originally Posted by donovan View Post
Hi Guy`s I`m a newbie to Unix and I`m starting to love it

I got stuck donig backups of tar files to tape

I use this to find all tar files
find . -name '*.tar.*' > output
in output there would be n of file eg. 6
the size output is 156 but tar files are:
9.3M Jul 18 09:48 arch_done_032007.tar.gz
25M Jul 18 09:53 arch_done_042007.tar.gz
67M Jul 18 10:01 arch_done_052007.tar.gz
192M Jul 18 10:27 arch_done_062007.tar.gz
291M Aug 2 11:05 arch_done_072007.tar.gz
544M Sep 3 12:05 arch_done_082007.tar.gz
I then tar output to tape using this command
tar -cvf /dev/rmt/0 output
response is
a 2.0K Sep 3 18:47 output

can you please help me on this matter

thanks donovan
You are not going about his the right way - I guess your newness to Unix is to blame.
Your find command will simply create a file called output with the names of the files found in it. your 'tar -cvf /dev/rmt/0 output' command will - if successful - just write the file output to tape - not the tar files.
If you want ot write the gzipped (.gz) files to tape then you have to include the names in the tar command - EG tar -cvf /dev/rmt/0 abc.tar.gz
If you want to exptract te contents of the tar.gz file you will have to 'gunzip' it first to get a tar file and then extract with tar -xvf <tar file name>

Start a thread with the 'New Thread' button at the top of the forum page
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0