Sponsored Content
Homework and Emergencies Homework & Coursework Questions Command combination for displaying header and content Post 302913883 by Don Cragun on Wednesday 20th of August 2014 01:30:11 PM
Old 08-20-2014
Quote:
Originally Posted by sreyan32
Thank you everyone who helped me here. I am asking is there a way to do this with head and tail commands ?

---------- Post updated at 09:57 PM ---------- Previous update was at 09:55 PM ----------
Quote:
Originally Posted by bakunin
It might also be worth the time to consult the manual page of sed: suppress default printing and selectively print the desired lines.

Well sir I am a total beginner to the commands. So I really have no idea what you mean. If you could give an example for some more info it would really be helpful. Thanks for replying though.
No sir. We are not here to do your homework for you. (And those who posted full solutions to your homework problem are subject to infractions for giving inappropriate responses to homework questions.) The suggestion bakunin made is well worth your attention. We all assume that you should know about the man utility and that the command:
Code:
man sed

would give you guidance on how to use the sed utility.

As you have already found out, removing lines from the middle of a set of lines to be printed just using head and tail in a single pipeline is, at best, tricky. (I didn't get enough sleep last night to say it is impossible, but a way to do it this way is not immediately obvious to me.)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract specific content from data and rename its header problem asking

Input file 1: >pattern_5 GAATTCGTTCATGTAGGTTGASDASFGDSGRTYRYGHDGSDFGSDGGDSGSDGSDFGSDF ATTTAATTATGATTCATACGTCATATGTTATTATTCAATCGTATAAAATTATGTGACCTT SDFSDGSDFKSDAFLKJASLFJASKLFSJAKJFHASJKFHASJKFHASJKFHSJAKFHAW >pattern_1 AAGTCTTAAGATATCACCGTCGATTAGGTTTATACAGCTTTTGTGTTATTTAAATTTGAC... (10 Replies)
Discussion started by: patrick87
10 Replies

2. Shell Programming and Scripting

Help with rename header content based on reference file problem

I got long list of reference file >data_tmp_number_22 >data_tmp_number_12 >data_tmp_number_20 . . Input file: >sample_data_1 Math, 5, USA, tmp SDFEWRWERWERWRWER FSFDSFSDFSDGSDGSD >sample_data_2 Math, 15, UK, tmp FDSFSDFF >sample_data_3 Math, 50, USA, tmp ARQERREQR . . Desired... (7 Replies)
Discussion started by: perl_beginner
7 Replies

3. UNIX for Dummies Questions & Answers

Banner not displaying full content

HI, while using banner command, i am not getting the full content in the screen: banner "UNIX AUTOMATION" # # # # ### # # # # # ####### ####### # # # # ## # # # # # # # # # # # ## ## # # # # # # ... (5 Replies)
Discussion started by: pandeesh
5 Replies

4. Homework & Coursework Questions

Linux displaying content information

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Using the fixed length field file called famous.dat make a one-line Unix command - using pipe(s) - to display an... (5 Replies)
Discussion started by: wizardoz123456
5 Replies

5. Shell Programming and Scripting

Print the column content based on the header

i have a input of csv file as below but the sequence of column get changed. I,e it is not necessary that name comes first then age and rest all, it may vary. name,age,marks,roll,section kevin,25,80,456,A Satch,23,56,789,B Meena,24,78,H245,C So i want to print that column entires which... (12 Replies)
Discussion started by: millan
12 Replies

6. UNIX for Dummies Questions & Answers

Command combination for displaying header and content

Hi everyone, I have UNIX this semester and I am just getting started with the commands. An interesting question came up while discussing the head and tail commands. Suppose that I have text file with the following data in the following format-: NAME ROLL MARKS Sam 05 ... (2 Replies)
Discussion started by: sreyan32
2 Replies

7. UNIX for Dummies Questions & Answers

Crunch character combination and discard similar content

Hi guys ! I generated the power set of the set S={a,b,c} using crunch: crunch 1 3 abc and get the 39 possible subsets: a b c aa ab ac ba bb bc ca cb cc … (2 Replies)
Discussion started by: beca123456
2 Replies

8. Shell Programming and Scripting

Displaying Column header in shell script

Hi, I need to display specific columns using select statement and spooled to a file and sending it as e-mail. But i am not seeing column header in my output even i use SET HEADING ON.//PREDEFINED LOGIN DETAILS ${ORACLE_HOME}/bin/sqlplus -s ${DB_LOGIN}/${DB_PASSWD} <<EOF SET FEEDBACK OFF SET... (1 Reply)
Discussion started by: pvelmuru
1 Replies

9. Shell Programming and Scripting

Problem while displaying(cat) file content inside telnet loop .

Hi Team, Not getting the file output inside my email which i am sending from unix box. . Please refer the below code : #!/bin/sh { sleep 5 echo ehlo 10.56.185.13 sleep 3 echo mail from: oraairtel@CNDBMUREAPZP02.localdomain sleep 3 echo rcpt to: saurabhtripathi@anniksystems.com... (1 Reply)
Discussion started by: tripathi1990
1 Replies

10. Shell Programming and Scripting

Content of attachment is displaying along with subject in mailx

Hi All, I want to send the csv to an email address. I have tried the below two approaches. Approach1: Got error -ksh: uuencode: not found $ uuencode test_file.csv test_file.csv | mailx -s "Attaching test" msdc.kiran@gmail.com </usr/home/test_file.csv -ksh: uuencode: not found Approach2:... (6 Replies)
Discussion started by: ROCK_PLSQL
6 Replies
fstadm(1M)																fstadm(1M)

NAME
fstadm - defines and manages file system stack templates SYNOPSIS
filename name] template_name template_name template_name DESCRIPTION
The command performs basic administrative operations on file system stack templates. Operations include creating and deleting templates, listing all templates on the system, and displaying the contents of templates. File system stack templates are used to describe the structure of a file system module stack. They contain information about the modules on a stack and the mount options for each module on the stack. All stack templates on a system reside in the system's stack template database. The only supported way to access and edit templates in the system template database is to use the command. The command also validates all templates at the time that they are created, to make sure that any dependency and compatibility constraints for modules on a stack are not violated. Dependency and compatibility constraints are specified by individual module developers, and enforces the constraints as needed. Note that end users do not need to be concerned about what constraints exist and how they are implemented: they only need to use to create all their templates, and will report on any problems with a user's proposed stack template. It is then easy to modify the inputs to to build a correctly validated template. Once a stack template is created and exists in the system template database, it can be used at mount time by specifying its name as a mount option. For example, the command below will mount the desired file system, with a stack described by template built above it. The file system on will now have the features of plus those of all of the modules on the stack described by Note that templates do not include information about the base file system to be mounted (e.g. or so the base file system must still be specified on the command line in the traditional way. (Support for templates that include base file systems is not included in the current versions of HP-UX.) can be invoked only by a user who has appropriate privileges. The behavior of the command depends upon the command name keyword specified as the first operand. Command Keywords and Options The following command keywords, arguments, and options are currently supported. Creates a new template. To describe a template, this command takes two types of input: o a text file that describes a template, specified with the option, or o a string that describes a template directly in the command line, specified with the option. The option cannot be used in conjunction with the option. A template can contain information about the mount options to use at each level of a stack. For information about the specific mount options that are available for each stackable file system module, consult the manpage for the module itself. The command uses the information in its input to validate and build a new template. If the new template's structure fails valida- tion, this command will abort and print an error message describing the problem. If validation succeeds, this command will create the template in the system template database and make it available for use with future mounts. The arguments that can be used with the keyword are: Specifies the name of a text file that describes the contents of a stack template. Information in the text file will be used as a guide to construct the desired stack template. The format of each line in the text file is: That is, each line of the text file describes one level of the desired stack. Within each line, a module and its mount options are separated by a single space character. The first line of the file represents the top of the stack, and the last line of the file represents the bottom. The format of these text files is identical to that of the output of the command key- word. Specifies the contents of a stack template. The format for this string is: That is, an entire stack is described within the string, and each level of a stack is separated by a semicolon Within a level, a module and its mount options are separated by a colon (But the colon does not need to be included for modules without mount options.) The leftmost module in the string represents the top of the stack, and the right-most module represents the bottom of the stack. Specifies the name of the template to be created. The maximum supported length for the template name is 128 characters. This is a required argument whenever is used. For if it is omitted, the name of the new template defaults to the name of the file specified with Overwrite option. If a template with the same name as the new template being created already exists, overwrites the old template. If this option is not specified, the command will fail whenever a template of the same name already exists. Note however that if a template of the same name exists AND is currently in use (in or the command will always fail, even if was specified. The rationale for this is that templates for stacks that are currently in use cannot be allowed to change. List all the templates in the system. This command displays the names of all templates currently stored in the system template database. Each template name is listed in its own line of output. Displays the contents of the specified template. This command will display the contents of the named template as text output, with each level of the stack described by one line of output. That is, each line of output will contain a module name, a space, and then the module's mount options (if any). The first line displayed represents the top of the stack, and the last line represents the bottom of the stack. Optionally, if it is redirected to a file, this output can also be used as input to via the option. Deletes the specified template from the system template database. If the template is currently in use (in or deletion is not allowed. In all other cases, the template will be removed from the sys- tem template database after user confirmation of the delete operation. (Template deletion is permanent and irrecoverable.) Forced delete of the specified template. Identical to but performs the deletion without asking for user confirmation. This command is provided for use by non-interactive scripts. Interactive help utility. Displays basic information about the various command keywords. RETURN VALUE
exits with one of the following values: Successful completion. An error condition occurred. Because is primarily an interactive command, an explanation of the error will be printed to standard error. EXAMPLES
List all the file system stack templates currently on the system: Display the contents of the stack template named Create a new template describing a stack that contains stacked modules named and (with module having a mount option set to 2), and name the template Delete the file system stack template named AUTHOR
was developed by HP. SEE ALSO
mount(1M). fstadm(1M)
All times are GMT -4. The time now is 04:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy