Sponsored Content
Top Forums Shell Programming and Scripting Find header in a text file and prepend it to all lines until another header is found Post 303036771 by Chubler_XL on Wednesday 10th of July 2019 11:04:55 PM
Old 07-11-2019
I'm guessing that all the appliance names do not start with the text "app".

A bit more of a generic approach might be to treat lines with only one field as an appliance name (assuming here that there are no spaces within the appliance name). The awk system variable NF contains the number of fields in the line so instead of /^app/ (line begins with app) to identify headers you could use NF == 1 (Number of fields on this line equals one) or even NF != 3 (Number of fields is not 3)
These 2 Users Gave Thanks to Chubler_XL For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Total of lines w/out header and footer incude for a file

I am trying to get a total number of tapes w/out headers or footers in a ERV file and append it to the file. For some reason I cannot get it to work. Any ideas? #!/bin/sh dat=`date +"%b%d_%Y"` + date +%b%d_%Y dat=Nov16_2006 tapemgr="/export/home/legato/tapemgr/rpts"... (1 Reply)
Discussion started by: gzs553
1 Replies

2. Shell Programming and Scripting

Convert Header into Column in Text file

Hi Gurus, I have a requirement like this and have to create a UX shell scripts. Thanks in advance. File-in: ------ Header2007-12-012007-11-21 100|xyz|was 101|wsa|qws ...... ....... Output should be: ------------------- 2007-12-01|100|xyz|was 2007-12-01|101|wsa|qws ...... .......... (7 Replies)
Discussion started by: vsubbu1000
7 Replies

3. Linux

Reading the header of a tar file(posix header)

say i have these many file in a directory named exam. 1)/exam/newfolder/link.txt. 2)/exam/newfolder1/ and i create a tar say exam.tar well the problem is, when i read the tar file i dont find any metadata about the directories,as you cannot create a tar containig empty directories. on the... (2 Replies)
Discussion started by: Tanvirk
2 Replies

4. Programming

to find header in Mp3 file and retrieve data

hi all, In an mp3 file , data is arranged in sequence of header and data ,how to retrieve data between two headers. Is the data between two headers fixed? because as per theory it says 1152 samples will be there , but dont knw how many bits one sample correspond to? it would help if any c... (2 Replies)
Discussion started by: shashi
2 Replies

5. UNIX for Dummies Questions & Answers

Sort and uniq lines of a file while keeping a header line

So, I have a file that has some duplicate lines. The file has a header line that I would like to keep at the top. I could do this by extracting the header from the file, 'sort -u' the remaining lines, and recombine them. But they are quite big, so if there is a way to do it with a single... (1 Reply)
Discussion started by: Digby
1 Replies

6. Shell Programming and Scripting

how can I bcp out a table into a text file including the header row in the text file

Hi All, I need to BCP out a table into a text file along with the table headers. Normal BCP out command only bulk copies the data, and not the headers. I am using the following command: bcp database1..table1 out file1.dat -c -t\| -b1000 -A8192 -Uuser -Ppassword -efile.dat.err Regards,... (0 Replies)
Discussion started by: shilpa_acc
0 Replies

7. Shell Programming and Scripting

Extract date from file header and prefix it to all lines

Hello All, I have a file in the following format. I want to extract the date(020090930, 020090929) in the string "STPAGE020090930" and "STPAGE020090929" and prefix it to all lines below them. The output must be put into a new file. STPAGE020090930 xyzz aalc... (3 Replies)
Discussion started by: john2022
3 Replies

8. UNIX for Dummies Questions & Answers

Merge all csv files in one folder considering only 1 header row and ignoring header of all others

Friends, I need help with the following in UNIX. Merge all csv files in one folder considering only 1 header row and ignoring header of all other files. FYI - All files are in same format and contains same headers. Thank you (4 Replies)
Discussion started by: Shiny_Roy
4 Replies

9. Shell Programming and Scripting

awk print header as text from separate file with getline

I would like to print the output beginning with a header from a seperate file like this: awk 'BEGIN{FS="_";print ((getline < "header.txt")>0)} { if (! ($0 ~ /EL/ ) print }" input.txtWhat am i doing wrong? (4 Replies)
Discussion started by: sdf
4 Replies

10. Shell Programming and Scripting

Put Header on Text file of all column

Hi I have in put file A.txt ABCDE1 JFHFJFJF3 1 1 SC1 12/10 ABCDE2 JFHFJFJF5 1 1 SC1 12/10 ABCDE3 JFHFJFJF5 1 1 SC1 12/10 ABCDE4 JFHFJFJF6 1 1 SC1 12/10 I want output in .csv with header: Name SUb_N x y No Board ABCDE1 JFHFJFJF3 1 1 SC1 12/10 ABCDE2 JFHFJFJF5 1 1 SC1... (7 Replies)
Discussion started by: pareshkp
7 Replies
LIVEMEDIA-CREATOR(1)					      General Commands Manual					      LIVEMEDIA-CREATOR(1)

NAME
livemedia-creator - Create live install media SYNOPSIS
livemedia-creator [-h] (--make-iso | --make-disk | --make-fsimage | --make-appliance | --make-ami) [--iso ISO] [--disk-image DISK_IMAGE] [--fs-image FS_IMAGE] [--ks KS] [--image-name IMAGE_NAME] [--image-only] [--keep-image] [--no-virt] [--proxy PROXY] [--anaconda-arg ANACONDA_ARGS] [--armplatform ARMPLATFORM] [--location LOCATION] [--logfile LOGFILE] [--lorax-templates LORAX_TEMPLATES] [--tmp TMP] [--resultdir RESULT_DIR] [--app-name APP_NAME] [--app-template APP_TEMPLATE] [--app-file APP_FILE] [--ram MEMORY] [--vcpus VCPUS] [--vnc VNC] [--arch ARCH] [--kernel-args KERNEL_ARGS] [--dracut-arg DRACUT_ARGS] [--title TITLE] [--project PROJECT] [--releasever RELEASEVER] [--volid VOLID] [--squashfs_args SQUASHFS_ARGS] DESCRIPTION
livemedia-creator uses Anaconda, kickstart and Lorax to create bootable media that use the same install path as a normal system install. It can be used to make live isos, bootable (partitioned) disk images and filesystem images for use with virtualization. The general idea is to use virt-install to install into a disk image and then use the disk image to create the bootable media. livemedia-creator --help will describe all of the options available. At the minimum you need: --make-iso to create a final bootable .iso --iso to specify the Anaconda install media to use with virt-install --ks is the kickstart to use to install the system OPTIONAL ARGUMENTS
: -h, --help show this help message and exit --make-iso Build a live iso --make-disk Build a partitioned disk image --make-fsimage Build a filesystem image --make-appliance Build an appliance image and XML description --make-ami Build an ami image --iso ISO Anaconda installation .iso path to use for virt-install --disk-image DISK_IMAGE Path to disk image to use for creating final image --fs-image FS_IMAGE Path to filesystem image to use for creating final image --ks KS Kickstart file defining the install. --image-name IMAGE_NAME Name of fs/disk image to create. Default is a random name. --image-only Exit after creating fs/disk image. --keep-image Keep raw disk image after .iso creation --no-virt Use Anaconda's image install instead of virt-install --proxy PROXY proxy URL to use for the install --anaconda-arg ANACONDA_ARGS Additional argument to pass to anaconda (no-virt mode). Pass once for eachargument --armplatform ARMPLATFORM the platform to use when creating images for ARM, i.e., highbank, mvebu, omap,tegra, etc. --location LOCATION location of iso directory tree with initrd.img and vmlinuz. Used to run virt-install with a newer initrd than the iso. --logfile LOGFILE Path to logfile --lorax-templates LORAX_TEMPLATES Path to mako templates for lorax --tmp TMP Top level temporary directory --resultdir RESULT_DIR Directory to copy the resulting images and iso into. Defaults to the temporaryworking directory --title TITLE Substituted for @TITLE@ in bootloader config files --project PROJECT substituted for @PROJECT@ in bootloader config files --releasever RELEASEVER substituted for @VERSION@ in bootloader config files --volid VOLID volume id --squashfs_args SQUASHFS_ARGS additional squashfs args APPLIANCE ARGUMENTS
: --app-name APP_NAME Name of appliance to pass to template --app-template APP_TEMPLATE Path to template to use for appliance data. --app-file APP_FILE Appliance template results file. VIRT-INSTALL ARGUMENTS: --ram MEMORY Memory to allocate for installer in megabytes. --vcpus VCPUS Passed to --vcpus command --vnc VNC Passed to --graphics command --arch ARCH Passed to --arch command --kernel-args KERNEL_ARGS Additional argument to pass to the installation kernel DRACUT ARGUMENTS
: --dracut-arg DRACUT_ARGS Argument to pass to dracut when rebuilding the initramfs. Pass this once foreach argument. NOTE: this overrides the default. SEE ALSO
Documentation in /usr/share/docs/lorax/README.livemedia-creator AUTHOR
Brian C. Lane 2013-07-26 LIVEMEDIA-CREATOR(1)
All times are GMT -4. The time now is 05:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy