Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How many lines are in a command. Post 302318012 by #moveon on Wednesday 20th of May 2009 01:46:56 PM
Old 05-20-2009
How many lines are in a command.

Hey I am learning shell-script as a beginner. I wanted to know how I can print out the number of lines in a command, is that possible first? I know of the command wc but it only works with file? What I want to do is, say I type in man ps and I get sooooo many lines. So I wanted to know if it is possible that I ask the programme to tell me the number of lines in that command or even go further and look for lines that contain the letters pr, for example.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Re: Long command lines

Hello, AIM: Need to test for the presence of some files (*.F) in a certain directory. having a problem with this line is ksh: if test `ls $SOMEDIR/dir/*.F \ 2>/dev/null|wc -w` -eq 0 Basically testing for the presence of *.F files in the specified directory. If the return... (4 Replies)
Discussion started by: enoch
4 Replies

2. UNIX for Dummies Questions & Answers

list last few lines command

Hi If my ls -l results in 1000 lines and i just want to see the last few lines in the list what arguments do i pass eg lets say i want to see only the last 5 lines of 'ls -l' result (2 Replies)
Discussion started by: zomboo
2 Replies

3. Shell Programming and Scripting

awk/sed Command : Parse parameter file / send the lines to the ksh export command

Sorry for the duplicate thread this one is similar to the one in https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121 Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies

4. Shell Programming and Scripting

Repeat same command on multiple lines

HI I have a text file named docs with 100 filenames with full directory path one by one. I want to perform an action on all of them, the action i want to do this chown bin:bin <filename>. The <filename> should be each line in the docs text file. Please give the code. Somebody told to use for... (2 Replies)
Discussion started by: PrasannaKS
2 Replies

5. Shell Programming and Scripting

Cat Command and Blank Lines

Hi All, I was testing for blank lines and I want to use the cat command only for groupline in `cat /home/test/group` do if then echo "blank found" fi done I want to check if the current line read is a blank line. I have tested with $groupline="\n" ,... (11 Replies)
Discussion started by: datkan
11 Replies

6. Shell Programming and Scripting

getting two lines by using grep command

i hav a text file(abc.txt) in which it have 2 lines as shown Number of agencies didnt send the file= 0 sum of reject files= 0 ###### to get one line from the text file ... i use grep command grep 'Number of agencies didnt send the file= 0' abc.txt ... (7 Replies)
Discussion started by: nani1984
7 Replies

7. Shell Programming and Scripting

bash logging al $() command lines

I have been doing a lot more bash on LINUX RedHat and Ubuntu lately, and one thing keeps cropping up intermittently. If I do a $( some-commands ) Command Substitution, the some-commands are logged onto my screen each time they are evaluated. Did I turn on some odd option? It seems to happen just... (13 Replies)
Discussion started by: DGPickett
13 Replies

8. Shell Programming and Scripting

Command on multiple lines

I am writing a script and my command is long so it goes down to the next line, but it does not run properly, the pipe is missing the wc -l. how do i fix this problem. find ${ARCHIVE}/${dir} -type f -name "${TEMP2}*" | awk -F/ '{print $NF}' | wc -l (8 Replies)
Discussion started by: football12345
8 Replies

9. UNIX for Advanced & Expert Users

Need command for grepping pattern lines with subsequent lines

Hi, I have a requirement like, I have a list of pattens in a file say pattern.txt, PHC111 PHC113 and in another file called master.lst i have entries like, PHC111 a b PHC112 a PHC113 b c PHC114 d e (5 Replies)
Discussion started by: rbalaj16
5 Replies

10. UNIX for Dummies Questions & Answers

What does this command do? and how to decode all other lines

Hello, I have an encoded file and I wish to see what is written inside. The first line is given below: eval "$(dd if=$0 bs=1 skip=69 2>/dev/null|gpg -d 2>/dev/null)"; exit PS: When I google above code, it says that command is use for encryption... Following lines include many strange... (2 Replies)
Discussion started by: baris35
2 Replies
SHAR(1) 						    BSD General Commands Manual 						   SHAR(1)

NAME
shar -- create a shell archive of files SYNOPSIS
shar file ... DESCRIPTION
shar writes an sh(1) shell script to the standard output which will recreate the file hierarchy specified by the command line operands. Directories will be recreated and must be specified before the files they contain (the find(1) utility does this correctly). shar is normally used for distributing files by ftp(1) or mail(1). SEE ALSO
compress(1), mail(1), tar(1), uuencode(1) BUGS
shar makes no provisions for special types of files or files containing magic characters. EXAMPLES
To create a shell archive of the program ls(1) and mail it to Rick: cd ls shar `find . -print` | mail -s "ls source" rick To recreate the program directory: mkdir ls cd ls ... <delete header lines and examine mailed archive> ... sh archive HISTORY
The shar command appears in 4.4BSD. SECURITY CONSIDERATIONS
It is easy to insert trojan horses into shar files. It is strongly recommended that all shell archive files be examined before running them through sh(1). Archives produced using this implementation of shar may be easily examined with the command: egrep -v '^[X#]' shar.file 4.4BSD June 6, 1993 4.4BSD
All times are GMT -4. The time now is 01:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy