The UNIX and Linux Forums  


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



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

Reply
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-01-2009
Registered User
 

Join Date: May 2009
Posts: 62
Error with my file

Hi,

I have a file like this (tab seperated):


Code:
title number
JR  2
JR  2
JR  4
JR  5
NM  5
NM  8
NM  2
NM  8

this code:


Code:
awk '!/^$/{a[$1]=a[$1]"      "$2} END {for ( i in a) {print i,a[i]}}' filename

converts the above files into a file that looks like this:


Code:
JR 2 2 4 5

NM 5 8 2 8

Hoever the problem that i am having is that the new file cant be read? so there is something wrong with the file after (like I cant modify it with grep, awk or anything). Perhaps it may be the line endings... can someone assist me?

thanks
  #2 (permalink)  
Old 12-01-2009
Registered User
 

Join Date: Jan 2009
Location: Va. Beach
Posts: 76
Define "cant be read" better. Are you getting an error when trying to read the file with something like 'cat' or 'more'? If so, what does the error say?
  #3 (permalink)  
Old 12-01-2009
Registered User
 

Join Date: May 2009
Posts: 62
hi there is no error message

like when I opent eh file there is characters... but when I run cat, awk or any of the commands, a blank document is the result.

I've run commands many times so its not the code that im using. I was just wondering if anyone else has run into a problem like this and whether there is a quick solution to the problem.
  #4 (permalink)  
Old 12-01-2009
Registered User
 

Join Date: Jan 2009
Location: Va. Beach
Posts: 76
What are you using to "open the file"? vi? some other editor?

What are the permissions on the file? Can you show me the result of an


Code:
ls -al <your.filename>

Sponsored Links
Reply

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 Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
fssnap error :snapshot error: File system could not be write locked aggadtech08 SUN Solaris 2 09-15-2009 11:12 AM
sqlplus error output to different error log file tomasba Shell Programming and Scripting 2 03-25-2009 08:59 AM
How to Redirect the error messages from Syslog file to our own Application Log File balasubramaniam HP-UX 3 04-17-2008 02:44 PM
Error checking a file from previous file size stuck1 Shell Programming and Scripting 2 12-06-2007 08:39 AM
Error: Internal system error: Unable to initialize standard output file firkus UNIX for Dummies Questions & Answers 2 10-25-2005 04:23 PM



All times are GMT -4. The time now is 02:18 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