Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to make paste -d second file print down while looping? Post 303038295 by Corona688 on Thursday 29th of August 2019 06:51:20 PM
Old 08-29-2019
One way:
Code:
#!/bin/bash

# Create temporary file to hold newlines
touch /tmp/$$

# Open both files to read line-by-line
exec 5<file1
exec 6<file2

# Read lines from both until file2 runs out
while read LINE <&6 && read LINE <&5
do
        :
done

# Run loop same number of times as lines left in file1.
while read LINE <&5
do
        cat /tmp/$$ file2 | paste file1 /dev/stdin
        echo >> /tmp/$$
        echo
done

cat /tmp/$$ file2 | paste file1 /dev/stdin


rm -f /tmp/$$ # Delete temporary file
# Close file descriptors
exec 5>&-
exec 6>&-

Re-looping I'm less certain of. Perhaps the files themselves should be generated at need. How large are they in a non-trivial example?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to print something in make utility

Hi want to know the syntax of printing something (value or variable) in GNU make utility. I give this in the Makefile: echo "Hi" OR @echo "Hi" But I only get error this when I run make (at the line where I have echo): Makefile:9: *** missing separator. Stop. Whats the problem? How can... (2 Replies)
Discussion started by: radiatejava
2 Replies

2. Shell Programming and Scripting

Paste content of a file to another file and make it as columned

Pls help me on this. I have to 2 files like shown below: File 1 TAIJM AXPKIM BEMGW File 2 PXMPA JYGE IMJP What i want to do is to paste both file to a new file on thir format: File 3 TAIJM PXMPA AXPKIM JYGE BEMGW IMJP I tried cat and print, but it doesn't work. Cn... (6 Replies)
Discussion started by: kingpeejay
6 Replies

3. Programming

makeutility: how to get the make-file name inside of the make-file?

How I can get the current make-file name in a make-file So, if I run make with specified file:make -f target.mak is it possible to have the 'target' inside of the that 'target.mak' from the file name? (2 Replies)
Discussion started by: alex_5161
2 Replies

4. Shell Programming and Scripting

How to make a long print string to shotcut form in perl?

print "1.readfromfile\n2.add_ex1(4,5)\n3.add_ex2(11,5)\n4.add_ex3(9,3)\n5.add_ex4(91,4)\n"; How to do it in this form: print "1.readfromfile\n 2.add_ex1(4,5)\n 3.add_ex2(11,5)\n 4.add_ex3(9,3)\n 5.add_ex4(91,4)\n"; (3 Replies)
Discussion started by: cola
3 Replies

5. Shell Programming and Scripting

Make pwd print escape character

I decided I wanted to have the cd command print my full working directory after each cd command, so I put this cw command in .bashrc as a function. cw () { cd "${1}" pwd }While this works I would like pwd to print escapes when a space in a directory name exists. This would... (7 Replies)
Discussion started by: jelloir
7 Replies

6. Shell Programming and Scripting

FILE_ID extraction from file name and save it in CSV file after looping through each folders

FILE_ID extraction from file name and save it in CSV file after looping through each folders My files are located in UNIX Server, i want to extract file_id and file_name from each file .and save it in a CSV file. How do I do that? I have folders in unix environment, directory structure is... (15 Replies)
Discussion started by: princetd001
15 Replies

7. Shell Programming and Scripting

Looping inside directories based on a file which contains file directory list

Hi All, Please help. I have got a file which contains a listing of a file and some directories after it, one by one. I am calling this file xyz.txt here file1 dir1 dir2 dir3 dir4 file2 dir5 dir6 dir7 dir8 file3 dir9 dir10 dir11 dir12 (6 Replies)
Discussion started by: Piyush Jakra
6 Replies

8. Shell Programming and Scripting

Looping structure to make up for lack of bash GOTO

Hello, I am re-processing some files when a specific condition is met. The condition is read from the filename. Since files may need to be re-processed a number of times before they no longer meet the condition, I need to know when to stop re-processing. I am having trouble visualizing the... (3 Replies)
Discussion started by: LMHmedchem
3 Replies

9. Shell Programming and Scripting

How to cut a pipe delimited file and paste it with another file to form a comma separated outputfile

Hello ppl I have a requirement to split (cut in unix) a file (A.txt) which is a pipe delimited file into A1.txt and A2.txt Now I have to join (paste in unix) this A2.txt with external file A3.txt to form output file A4.txt which should be CSV (comma separated file) so that third party can... (25 Replies)
Discussion started by: etldev
25 Replies

10. UNIX for Beginners Questions & Answers

How to make second file print down the whole first file?

Using Python I have 2 text files (big files over 1gb) that opens side by side on the same line in terminal, but I want the file on the right to print down the other file while the file on the left is stationary or displayed all at once. I want to print text file 2 through all of text file 1. ... (6 Replies)
Discussion started by: bigvito19
6 Replies
SANDBOX(8)							   User Commands							SANDBOX(8)

NAME
sandbox - Run cmd under an SELinux sandbox SYNOPSIS
sandbox [-C] [-c] [-s] [ -d DPI ] [-l level ] [[-M | -X] -H homedir -T tempdir ] [-I includefile ] [ -W windowmanager ] [ -w windowsize ] [[-i file ]...] [ -t type ] cmd sandbox [-C] [-c] [-s] [ -d DPI ] [-l level ] [[-M | -X] -H homedir -T tempdir ] [-I includefile ] [ -W windowmanager ] [ -w windowsize ] [[-i file ]...] [ -t type ] -S DESCRIPTION
Run the cmd application within a tightly confined SELinux domain. The default sandbox domain only allows applications the ability to read and write stdin, stdout and any other file descriptors handed to it. It is not allowed to open any other files. The -M option will mount an alternate homedir and tmpdir to be used by the sandbox. If you have the policycoreutils-sandbox package installed, you can use the -X option and the -M option. sandbox -X allows you to run X applications within a sandbox. These applications will start up their own X Server and create a temporary home directory and /tmp. The default SELinux policy does not allow any capabilities or network access. It also prevents all access to the users other processes and files. Files specified on the command that are in the home directory or /tmp will be copied into the sandbox directories. If directories are specified with -H or -T the directory will have its context modified with chcon(1) unless a level is specified with -l. If the MLS/MCS security level is specified, the user is responsible to set the correct labels. -h --help display usage message -H --homedir Use alternate homedir to mount over your home directory. Defaults to temporary. Requires -X or -M. -i --include Copy this file into the appropriate temporary sandbox directory. Command can be repeated. -I --includefile Copy all files listed in inputfile into the appropriate temporary sandbox directories. -l --level Specify the MLS/MCS Security Level to run the sandbox with. Defaults to random. -M --mount Create a Sandbox with temporary files for $HOME and /tmp. -s --shred Shred temporary files created in $HOME and /tmp, before deleting. -t --type Use alternate sandbox type, defaults to sandbox_t or sandbox_x_t for -X. Examples: sandbox_t - No X, No Network Access, No Open, read/write on passed in file descriptors. sandbox_min_t - No Network Access sandbox_x_t - Printer Ports sandbox_web_t - Ports required for web browsing sandbox_net_t - All network ports -T --tmpdir Use alternate temporary directory to mount on /tmp. Defaults to tmpfs. Requires -X or -M. -S --session Run a full desktop session, Requires level, and home and tmpdir. -w --windowsize Specifies the windowsize when creating an X based Sandbox. The default windowsize is 1000x700. -W --windowmanager Select alternative window manager to run within sandbox -X. Default to /usr/bin/matchbox-window-manager. -X Create an X based Sandbox for gui apps, temporary files for $HOME and /tmp, secondary Xserver, defaults to sandbox_x_t -d --dpi Set the DPI value for the sandbox X Server. Defaults to the current X Sever DPI. -c --cgroups Use control groups to control this copy of sandbox. Specify parameters in /etc/sysconfig/sandbox. Max memory usage and cpu usage are to be specified in percent. You can specify which CPUs to use by numbering them 0,1,2... etc. -C --capabilities Use capabilities within the sandbox. By default applications executed within the sandbox will not be allowed to use capabilities (setuid apps), with the -C flag, you can use programs requiring capabilities. SEE ALSO
runcon(1), seunshare(8), selinux(8) AUTHOR
This manual page was written by Dan Walsh <dwalsh@redhat.com> and Thomas Liu <tliu@fedoraproject.org> sandbox May 2010 SANDBOX(8)
All times are GMT -4. The time now is 09:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy