Sponsored Content
Top Forums Shell Programming and Scripting Read file from input and redirect to output file Post 302845443 by rohit_shinez on Wednesday 21st of August 2013 02:03:23 PM
Old 08-21-2013
Read file from input and redirect to output file

Hi ,

i am having an file which contains 5 file_name data, i need to read the file name and will perform certain operation and generate out file names with named as 5 individual file_names
for eg:
Code:
file.txt contains
file_name1.txt|hai
file_name2.txt|bye
file_name3.txt|how
file_name4.txt|are
file_name5.txt|you

i will read using 
for i in `cat file.txt`
and do certain operations like

sed '$d' file_name1.txt >file_name1.tmp
echo "read the second row from file.txt">>file_name1.tmp
mv file_name1.tmp file_name1.txt

like the above i need to perform for all files and my output files should be
file_name1.txt
.
.
.
.
last line to print hai

file_name2.txt
.
.
.
bye

like this i need 5 individual files

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

redirect input from file?

I need to run a command inside root-environment, and want to use: su - root -c "some command..." Then I am prompted for a password, of course. Is it possible to put this password in a file, and present this files content, to the command above?:confused: (1 Reply)
Discussion started by: bjornrud
1 Replies

2. Shell Programming and Scripting

Input file redirect in output path and want name as inputfilename_new.txt

not required this time (6 Replies)
Discussion started by: Sandeep_Malik
6 Replies

3. Shell Programming and Scripting

Dynamic output file generation using a input text file with predefined output format

Hi, I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format. Example: File.txt AP|{SSHA}VEEg42CNCghUnGhCVg== APVG3|{SSHA}XK|"password" AP3|{SSHA}XK|"This is test" .... etc --------- test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies

4. UNIX for Advanced & Expert Users

Complex Input/Output Redirect

Hi All, Sorry if the title is not good but I did not know how to explain with only some words! What I meant is: I have a unix command built from a private application vendor that when executed it prompts for two entries by the keyboard, let's say, for example: ... (1 Reply)
Discussion started by: felipe.vinturin
1 Replies

5. Shell Programming and Scripting

How to redirect a input of find command into a text file

Hello friends, I want a command to print the reult files from find command into a text file.:) Iam looking from forum memebers. PLZ help me.ASAP Thanks in Advance, Siva Ranganath CH (5 Replies)
Discussion started by: sivaranga001
5 Replies

6. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

7. Shell Programming and Scripting

Read input files and merge them in given order and write them to input one param or one file

Dear Friends, I am looking for a shell script to merge input files into one file .. here is my idea: 1st paramter would be outfile file (all input files content) read all input files and merge them to input param 1 ex: if I pass 6 file names to the script then 1st file name as output file... (4 Replies)
Discussion started by: hyd1234
4 Replies

8. Shell Programming and Scripting

How to read each line from input file, assign variables, and echo to output file?

I've got a file that looks like this (spaces before first entries intentional): 12345650-000005000GL140227 ANNUAL HELC FEE EN 22345650-000005000GL140227 ANNUAL HELC FEE EN 32345650-000005000GL140227 ANNUAL HELC FEE EN I want to read through the file line by line,... (6 Replies)
Discussion started by: Scottie1954
6 Replies

9. UNIX for Dummies Questions & Answers

Redirect output to the same input file in awk

Hi, I want to compare a value from test file and redirect the o/p value to the same file input file 250 32000 32 128 Below is my code awk '{ if ($1 < "300") print $1 > /tmp/test}' test want to compare 250 < 300 then print 300 to the same place below is the... (24 Replies)
Discussion started by: stew
24 Replies

10. Shell Programming and Scripting

ksh - Read input from file and output CSV i same row

Hello I have the following output and want the output to look: FROM: GigabitEthernet0/0 is up, line protocol is up 1 input errors, 0 CRC, 0 frame, 1 overrun, 0 ignored 275 output errors, 0 collisions, 3 interface resets GigabitEthernet0/1 is up, line protocol is up 0... (4 Replies)
Discussion started by: JayJay2018
4 Replies
POSTMAP(1)						      General Commands Manual							POSTMAP(1)

NAME
postmap - Postfix lookup table management SYNOPSIS
postmap [-Nfinrvw] [-c config_dir] [-d key] [-q key] [file_type:]file_name ... DESCRIPTION
The postmap command creates or queries one or more Postfix lookup tables, or updates an existing one. The input and output file formats are expected to be compatible with: makemap file_type file_name < file_name If the result files do not exist they will be created with the same group and other read permissions as the source file. While the table update is in progress, signal delivery is postponed, and an exclusive, advisory, lock is placed on the entire table, in order to avoid surprises in spectator programs. The format of a lookup table input file is as follows: o A table entry has the form key whitespace value o Empty lines and whitespace-only lines are ignored, as are lines whose first non-whitespace character is a `#'. o A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line. The key and value are processed as is, except that surrounding white space is stripped off. Unlike with Postfix alias databases, quotes cannot be used to protect lookup keys that contain special characters such as `#' or whitespace. The key is mapped to lowercase to make mapping lookups case insensitive. Options: -N Include the terminating null character that terminates lookup keys and values. By default, Postfix does whatever is the default for the host operating system. -c config_dir Read the main.cf configuration file in the named directory instead of the default configuration directory. -d key Search the specified maps for key and remove one entry per map. The exit status is zero when the requested information was found. If a key value of - is specified, the program reads key values from the standard input stream. The exit status is zero when at least one of the requested keys was found. -f Do not fold the lookup key to lower case while creating or querying a map. -i Incremental mode. Read entries from standard input and do not truncate an existing database. By default, postmap creates a new data- base from the entries in file_name. -n Don't include the terminating null character that terminates lookup keys and values. By default, Postfix does whatever is the default for the host operating system. -q key Search the specified maps for key and print the first value found on the standard output stream. The exit status is zero when the requested information was found. If a key value of - is specified, the program reads key values from the standard input stream and prints one line of key value out- put for each key that was found. The exit status is zero when at least one of the requested keys was found. -r When updating a table, do not warn about duplicate entries; silently replace them. -v Enable verbose logging for debugging purposes. Multiple -v options make the software increasingly verbose. -w When updating a table, do not warn about duplicate entries; silently ignore them. Arguments: file_type The type of database to be produced. btree The output file is a btree file, named file_name.db. This is available only on systems with support for db databases. dbm The output consists of two files, named file_name.pag and file_name.dir. This is available only on systems with support for dbm databases. hash The output file is a hashed file, named file_name.db. This is available only on systems with support for db databases. When no file_type is specified, the software uses the database type specified via the database_type configuration parameter. file_name The name of the lookup table source file when rebuilding a database. DIAGNOSTICS
Problems and transactions are logged to the standard error stream. No output means no problems. Duplicate entries are skipped and are flagged with a warning. postmap terminates with zero exit status in case of success (including successful postmap -q lookup) and terminates with non-zero exit sta- tus in case of failure. ENVIRONMENT
MAIL_CONFIG Directory with Postfix configuration files. MAIL_VERBOSE Enable verbose logging for debugging purposes. CONFIGURATION PARAMETERS
database_type Default output database type. On many UNIX systems, the default database type is either hash or dbm. LICENSE
The Secure Mailer license must be distributed with this software. AUTHOR(S) Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA POSTMAP(1)
All times are GMT -4. The time now is 07:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy