Sponsored Content
Top Forums Shell Programming and Scripting Output all data of files into one file Post 302861033 by Manu1234567 on Tuesday 8th of October 2013 12:13:44 AM
Old 10-08-2013
Quote:
Originally Posted by Akshay Hegde
Awk solution

your file

Code:
$ cat manu.txt 
ffrs44frfrf
123.33.44.3

Code:
$ cat katty.txt 
d4r4ff5rf5
123.44.32.4

Code:
$ awk '{i++;split(FILENAME,A,".");printf (i==1)?"Host"FS A[1] "{"RS "CODE :"FS$0RS:"Address :"FS$0";"RS"}"RS RS}{i=(i!=1)?0:1}' *.txt

resulting
Code:
Host katty{
CODE :  d4r4ff5rf5
Address : 123.44.32.4;
}

Host manu{
CODE : ffrs44frfrf
Address : 123.33.44.3;
}

replace
Code:
 *.txt

with your
Code:
filepath

LOl awk?!)) basically, i will try to change on if -while statement))) Anyway thank u so much Smilie

Last edited by Manu1234567; 10-08-2013 at 01:19 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using AWK: Extract data from multiple files and output to multiple new files

Hi, I'd like to process multiple files. For example: file1.txt file2.txt file3.txt Each file contains several lines of data. I want to extract a piece of data and output it to a new file. file1.txt ----> newfile1.txt file2.txt ----> newfile2.txt file3.txt ----> newfile3.txt Here is... (3 Replies)
Discussion started by: Liverpaul09
3 Replies

2. Shell Programming and Scripting

How to add data from 2 input files and save it in 1 output file

Hi, i have 2 input files which are file1.txt and file2.txt. I need to extract data from file1.txt and file2.txt and save it in file3.txt like example below:- File1.txt ID scrap1 Name scrap1 start 1 end 10 ID scrap2 Name scrap2 start 11 end ... (4 Replies)
Discussion started by: redse171
4 Replies

3. Shell Programming and Scripting

split input data file and put into same output file

Hi All, I have two input file and need to generate a CSV file. The existing report just "GREP" the records with the Header and Tailer records with the count of records. Now i need to split the data into 25 records each in the same CSV file. id_file (Input file ) 227050994 232510151... (4 Replies)
Discussion started by: rasmith
4 Replies

4. Shell Programming and Scripting

How to fill data from other file and get some output

Greetings, I have a hard time creating a large number of user profiles in a database. The data file looks like this : 01/01/80 Mitch Conley . . . . And I need to put the output into: Name: Mitch Surname: Conley Birthday: 01/01/80 Thanks in advance! (3 Replies)
Discussion started by: hemo21
3 Replies

5. Shell Programming and Scripting

awk help: Match data fields from 2 files & output results from both into 1 file

I need to take 2 input files and create 1 output based on matches from each file. I am looking to match field #1 in both files (Userid) and create an output file that will be a combination of fields from both file1 and file2 if there are any differences in the fields 2,3,4,5,or 6. Below is an... (5 Replies)
Discussion started by: ambroze
5 Replies

6. Shell Programming and Scripting

How to output selective delimited data to a new file?

I have the following file which at times can be quite large so can be difficult to read, I need a script that just extracts particular delimited data and outputs to alternate file $cat fix1.log FIX4.4|0=12|55=LIT.L|48=123456|32=5|52=20111107-10:52:22.128|38=100|10=200| ... (6 Replies)
Discussion started by: Buddyluv
6 Replies

7. Shell Programming and Scripting

Help with add existing file name as new data column in new output file

Input File 1 cat S1.txt MI0043 2731 miR-1 Input File 2 cat S4.txt MI006 310 CiR-1 MI057 10 CiR-24 MI750 5 CiR-24 Desired Output File 1 cat S1.txt.out MI0043 2731 miR-1 S1.txt Desired Output File 2 cat S4.txt.out MI006 310 CiR-1 S4.txt (3 Replies)
Discussion started by: perl_beginner
3 Replies

8. Shell Programming and Scripting

Extra data in output file

Gents, I did a small scritp called make_file It read file1.txt file and generate an output as attached.. But the script is showing more extra information not needed. I have attached the output file as desired. Could you please help to fix this scrip to get the correct output Thanks... (4 Replies)
Discussion started by: jiam912
4 Replies

9. Shell Programming and Scripting

awk to reformat output if input file is empty, but not if file has data in it

The below awk improved bu @MadeInGermany, works great as long as the input file has data in it in the below format: input chrX 25031028 25031925 chrX:25031028-25031925 ARX 631 18 chrX 25031028 25031925 chrX:25031028-25031925 ARX 632 14... (3 Replies)
Discussion started by: cmccabe
3 Replies

10. Shell Programming and Scripting

In PErl script: need to read the data one file and generate multiple files based on the data

We have the data looks like below in a log file. I want to generat files based on the string between two hash(#) symbol like below Source: #ext1#test1.tale2 drop #ext1#test11.tale21 drop #ext1#test123.tale21 drop #ext2#test1.tale21 drop #ext2#test12.tale21 drop #ext3#test11.tale21 drop... (5 Replies)
Discussion started by: Sanjeev G
5 Replies
gnomevfs-cat(1) 						   User Commands						   gnomevfs-cat(1)

NAME
gnomevfs-cat - print a file to standard output using the VFS system SYNOPSIS
gnomevfs-cat URI DESCRIPTION
gnomevfs-cat is obsolete. It has been superseded by gvfs-cat. See gvfs-cat(1). gnomevfs-cat prints a file to standard output using the virtual file system to access the file via a URI. OPERANDS
The following operands are supported: URI Specifies the file location in standard URI format. EXAMPLES
Example 1: Cat a File From a Web Server example% gnomevfs-cat http://www.sun.com Example 2: Cat a Local File example% gnomevfs-cat file:///home/user/README.txt ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables: NLSPATH. EXIT STATUS
The exit value 0 is returned regardless of success or failure. FILES
The following files are used by this application: /usr/bin/gnomevfs-cat Executable to print a file to standard output using the VFS system ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-vfs | +-----------------------------+-----------------------------+ |Interface stability |Obsolete Volatile | +-----------------------------+-----------------------------+ SEE ALSO
gnomevfs-copy(1), gnomevfs-info(1), gnomevfs-ls(1), gnomevfs-mkdir(1), gvfs-cat(1), attributes(5), environ(5) NOTES
Written by Stephen Browne, Sun Microsystems Inc., 2004. SunOS 5.11 14 May 2008 gnomevfs-cat(1)
All times are GMT -4. The time now is 03:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy