Sponsored Content
Full Discussion: Using cat and awk.......
Top Forums Shell Programming and Scripting Using cat and awk....... Post 302376167 by bigben1220 on Monday 30th of November 2009 09:12:42 PM
Old 11-30-2009
Imtrying to read the information, the use the bdf command to list the space used (etc). After that Im trying to get the info to display on the screen.

Below is what Ive been playing around with. While using the while do loop, do you have to use the output redirection?

Code:
while read list
do
        bdf $list
done <junk.txt | cat junk.txt | awk '{print$1}' | sort -n | grep -v used | awk '
{sum += $1} END { print sum;}'



---------- Post updated at 09:12 PM ---------- Previous update was at 09:07 PM ----------

I keep getting the error message:

cat: Cannot open junk.txt: No such file or directory,

I thought by using the awk/cat command it would create this file?

Bigben

Sorry If Im bothering anyone-just trying to learn.

Last edited by pludi; 12-01-2009 at 02:01 AM.. Reason: closed code block
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Difference between cat , cat > , cat >> and touch !!!

Hi Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX? Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies

2. Shell Programming and Scripting

cat & awk

Hi there, Can show some hit why i got this error? For eg i have a.txt in which consist of contents as below 1|781494-0015|IV\|I||C|RECHARGE|Success\|V\|\||2007-12-04 02:33:13.000| 2|762405-0405|IV\|I||C|RECHARGE|Success\|V\|\||2007-12-04 02:33:17.000| In fact , i want to perfrom to have... (2 Replies)
Discussion started by: rauphelhunter
2 Replies

3. Shell Programming and Scripting

cat in the command line doesn't match cat in the script

Hello, So I sorted my file as I was supposed to: sort -n -r -k 2 -k 1 file1 | uniq > file2 and when I wrote > cat file2 in the command line, I got what I was expecting, but in the script itself ... sort -n -r -k 2 -k 1 averages | uniq > temp cat file2 It wrote a whole... (21 Replies)
Discussion started by: shira
21 Replies

4. UNIX for Dummies Questions & Answers

tr, sed, awk, cat or scripting

I need to change all Newline caracters (\12) to Fieldseparator(\34). tr -A '\12' '\34' <file1> file2 Replace all delete (\177) with Newline (\12) tr -A '\177' '\12' <file2> file3 Put the name of the file first in all rows. awk '{printf "%s\34%s\n", FILENAME,$0} file3 > file4 So far no... (6 Replies)
Discussion started by: MrKlint
6 Replies

5. Shell Programming and Scripting

Understanding Awk and Cat

Hi Guys, I was recently come across some code to hopefully learn a little bit about putting Shell commands into PHP application to run on a Linux server. However, I don't understand the command AT ALL... and was wondering if anyone can interpret it: cat userIDs.dat | awk '{s=s+1; if... (1 Reply)
Discussion started by: jordRiot
1 Replies

6. UNIX for Dummies Questions & Answers

awk+cat

Hi, I am doing this: ll -tr | awk '{print $6, $7, $8, $9}' the result is: Dec 30 2008 text1.txt Mar 4 2009 text2.txt Apr 10 2009 text3.txt and now I want to show the content of $9 using below: ll -tr | awk '{print $6, $7, $8, $9}' ; '{cat $9}' (25 Replies)
Discussion started by: messi777
25 Replies

7. UNIX for Dummies Questions & Answers

How to pass cat file in awk statement?

Hi, I am working on kernel parameters, want to check values under /proc/sys/kernel below I tried for kernel.sem SEMMNS: 4096 cat /proc/sys/kernel/sem | awk '{print $2}' awk '{ if ($2 < 33000) print }' /proc/sys/kernel/sem |awk '{print $2}' 32000 The above... (7 Replies)
Discussion started by: stew
7 Replies

8. Shell Programming and Scripting

Spacing off when files combined using awk or cat

I have 133 .txt files in a directory that I am combining into 1 file. The problem is when I use awk or cat to combine the files I get out put like this: output 85 138662360 KCNT1 86 138662962 KCNT1 82 138657053 KCNT1 83 138657635 KCNT1 95 138646881 KCNT1... (12 Replies)
Discussion started by: cmccabe
12 Replies

9. Shell Programming and Scripting

Need to add prefix using sed or awk from cat the file

I need the use sed or AWK using cat the file Node1 TDEV RW 1035788 TDEV RW 1035788 Server1 TDEV RW 69053 Server2 TDEV RW 69053 TDEV RW 103579 Server3 TDEV RW 69053 server4 RDF1+TDEV RW 69053 RDF1+TDEV RW 517894 RDF1+TDEV RW 621473 server6 TDEV RW 34526 TDEV RW 34526 (22 Replies)
Discussion started by: ranjancom2000
22 Replies
CDCTRL(1)							   User Commands							 CDCTRL(1)

NAME
cdctrl - command line CDROM control SYNOPSIS
cdctrl [device] cdctrl -c [device] cdctrl -c cdctrl [-V|-?|-h] DESCRIPTION
cdctrl command is a program that opens a CDROM device and may be used for interactive control of the CDROM including play starting at a track, next track, previous track, stop, pause, display info, display CDROM status, and display CDROM directory. This program may be used as a daemon to control an audio CDROM device. The commands to the cdctrl command are: device Open CDROM device. -V Print out version and build information. -h Display help. -v Display help. -D Enable runtime debugging. -c Output CR-LF at end of each line, not LF. By default, cdctrl opens /dev/cdrom, but does not start playing. Output is to standard output with each line terminated by a linefeed (LF). Commands to cdctrl are: 1 Play first track, start playing. s Stop playing. p Pause playing. r Resume playing. e Eject CDROM. c Close CDROM tray. i Display info string. d Display directory. - Play previous track. + Play next track. When on last track, play first track. [1..99] Play track 1..99. ? Display help screen. q Quit. Each command results in one or multiple lines of output to stdout, followed by an info string, followed by END. The format of the info string is: CMD cmd-name cd-status track abs-time rel-time cmd-name := {play, stop, ... quit} from above list cd-status := {invalid, play, paused} cd-status += {completed, error, no_status} track := {1..99} CD track abs-time := HH:MM:SS elapsed since CD start rel-time := HH:MM:SS elapsed since track start FILES
/dev/cdrom - default cdrom device ENVIRONMENT
CDTOOLDEV - cdrom device, overrides compile time defaults SEE ALSO
cdplay(1) AUTHORS
Main code: Thomas Insel <tinsel@tinsel.org> Enhancements: Sven Oliver Moll <smol0075@rz.uni-hildesheim.de> cdctrl extensions: Wade Hampton <whampton@staffnet.com> CDTOOL
29-July-2004 CDCTRL(1)
All times are GMT -4. The time now is 06:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy