Sponsored Content
Top Forums Shell Programming and Scripting Removing part of a file name and appending into a single file Post 302635351 by brianjb on Friday 4th of May 2012 04:18:08 PM
Old 05-04-2012
This is just a sample. I am sure you can modify it to fit your needs:

Code:
#!/bin/sh
filemerge=/path/merge
newfile=/path/abc_def_xxx.txt.
#
ls /path/directory/ | grep abc_def* > $filemerge
#
for j in `cat $filemerge`
do
cat $j >> $newfile
echo "adding $filemerge to $newfile"
done
rm $filemerge

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

replace part of single string in a file

hi! i have a file consisting of the following lines: (BTW, = space) . . . 12ME_T1mapping_flip30bshortf 13DCE_whole_brainbshortf 13DCE_3Dbshortf . . . the list of scans starts at 1 and goes on sometimes up to 60 scans. i would like to change only the lines that contain 'whole' to... (2 Replies)
Discussion started by: nixjennings
2 Replies

2. UNIX for Dummies Questions & Answers

Need advice! Removing multiple entries in a single file!

Hello, I have a file Test.txt with 9 columns that looks like this: 1g12 A 14 19 2OAY A 326 331 AAAASA 1l7v A 68 73 1l7v A 68 73 AALAIS 1l7v A 68 73 1XVW B 72 77 AALAIS 1l7v A 68 73 1XXU A 65 70 AALAIS 1l7v A 68 73 1XXU B 65 70 AALAIS 1l7v A 68 73 1XXU C 65 70 AALAIS 1l7v A 68 73 1XXU D... (4 Replies)
Discussion started by: InfoSeeker
4 Replies

3. Shell Programming and Scripting

rename file by removing some part of the file name

I am special requirements to rename file. I have files with names like below: 1_firstname1_lastname1.html 2_firstname2_lastname2.html 3_fistname3_lastname2.html I would like these file to be renamed as below firstname1_lastname1.html firstname2_lastname2.html... (5 Replies)
Discussion started by: McLan
5 Replies

4. UNIX for Dummies Questions & Answers

appending in a single text file

actually, i have to grep the value of cpu usage from six differrent servers and it has to generated in a single report( in a single text or excel file). i have used the below command for grepping the value. top -n 1 > arun.txt cat arun.txt | grep 'init' | cut -c 49-53 > output1.csv like... (2 Replies)
Discussion started by: arunmanas
2 Replies

5. Shell Programming and Scripting

Removing duplicate records in a file based on single column

Hi, I want to remove duplicate records including the first line based on column1. For example inputfile(filer.txt): ------------- 1,3000,5000 1,4000,6000 2,4000,600 2,5000,700 3,60000,4000 4,7000,7777 5,999,8888 expected output: ---------------- 3,60000,4000 4,7000,7777... (5 Replies)
Discussion started by: G.K.K
5 Replies

6. Shell Programming and Scripting

Removing duplicate records in a file based on single column explanation

I was reading this thread. It looks like a simpler way to say this is to only keep uniq lines based on field or column 1. https://www.unix.com/shell-programming-scripting/165717-removing-duplicate-records-file-based-single-column.html Can someone explain this command please? How are there no... (5 Replies)
Discussion started by: cokedude
5 Replies

7. Shell Programming and Scripting

removing part of a file

Right this is quite a long one, I have a script which complies all listed stats files into one file and emails it out, However this has to be run manually and i would like it to run automatically, I have a list of files eg sa17 sa18 sa19 sa20 sa21 one file for each of last weeks... (9 Replies)
Discussion started by: Bdoydie
9 Replies

8. Shell Programming and Scripting

Shell script - Replace just part of a single line in a file.....

Hey guy's.... I new here, But im working on a school project, and I am not really good at programming. In fact, this is the only programming class that I need because programming is not what I am majoring in. But I have everything done in this shell script except for this last part..... ... (9 Replies)
Discussion started by: hxdrummerxc
9 Replies

9. Shell Programming and Scripting

Removing duplicates on a single "column" (delimited file)

Hello ! I'm quite new to linux but haven't found a script to do this task, unfortunately my knowledge is quite limited on shellscripts... Could you guys help me removing the duplicate lines of a file, based only on a single "column"? For example: M202034357;01/2008;J30RJ021;Ciclo 01... (4 Replies)
Discussion started by: Rufinofr
4 Replies
bcron-update(8) 					      System Manager's Manual						   bcron-update(8)

NAME
bcron-update - Update system crontabs. SYNOPSIS
bcron-update path [ path ... ] DESCRIPTION
bcron-update polls the named files or directories periodically to see if there are any new, changed, or removed files. When it detects changes, it mirrors those changes into the crontab spool directory. bcron-update runs as root in order to be able to read system files that would potentially be unreadable otherwise. On Debian, if path is a directory, bcron-update skips files in this directory with names that do not solely consist of lower- and uppercase letters ('a'-'z', 'A'-'Z'), digits ('0'-'9'), underscores ('_'), and hyphens ('-'). EXAMPLES
To mirror modern vixie-cron's behavior, use: bcron-update /etc/crontab /etc/cron.d ENVIRONMENT
BCRON_SPOOL The spool directory for bcron. Defaults to /var/spool/cron. BCRON_USER After writing files and before moving them into their final location, bcron-update changes the ownership of the file to this user so that bcron-sched can read them. SEE ALSO
bcron-sched(8) DIAGNOSTICS
bcron-update outputs three different kinds of messages about actions it is taking. Rescanning /etc/cron.d The named directory has been modified, and will be scanned to determine what files have been added or deleted. -/etc/cron.d/oldfile The named file no longer exists and will be removed from the spool. +/etc/cron.d/newfile The named file was either created or modified since the last scan, and will be copied into the spool. AUTHOR
Bruce Guenter <bruceg@em.ca> bcron-update(8)
All times are GMT -4. The time now is 12:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy