![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem with output of find command being input to basename command... | new_learner | UNIX for Dummies Questions & Answers | 2 | 12-14-2008 02:56 AM |
| awk/sed Command : Parse parameter file / send the lines to the ksh export command | rajan_san | Shell Programming and Scripting | 4 | 11-06-2008 01:29 PM |
| assign a command line argument and a unix command to awk variables | sweta_doshi | Shell Programming and Scripting | 0 | 08-08-2008 06:54 AM |
| Help Required: Command to find IP address and command executed of a user | loggedout | Security | 2 | 08-06-2008 08:12 PM |
| inconsistent ls command display at the command prompt & running as a cron job | rajranibl | SuSE | 5 | 07-30-2007 08:26 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Cat command help
I want to concatenate 100 files to one file and append file name in each record to find out which file it came from
Code:
for a in $(<shal_group) do cat $a >> bigoutput.group Record should be like this file1| data ... fiel2| data.... Appreciate your help |
|
||||
|
Quote:
I need a minor change in this. Record looks like this /user/tmp/server1_etc_group| data ... /user/tmp/server2_etc_group| data.... I want data like this server1|data.... server2|data Thank you sir |
|
||||
|
Hi,
Try the below code: Code:
#!/bin/sh for i in `cat concatinfile` do while read line do echo "`echo $i | cut -d"/" -f4 | cut -d"_" -f1`: $line" >> concatoutfile done < $i done here "concatinfile" is the inputfile which contains the list of files to be concated. "concatoutfile" is the output file Reg, Abinaya |
| Sponsored Links | ||
|
|