Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Copy filepath along with filename at end of another file Post 302998394 by jim mcnamara on Wednesday 31st of May 2017 10:38:12 AM
Old 05-31-2017
One way:
Code:
 printf "command.sh %s/abc.txt" $(pwd) >> ll.sh

This will only work when the current directory is the same as both files: abc.txt and ll.sh
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grabing Date from filename and adding to the end of each line in the file.

Hi, I have 24 .dat files something like below. The file name starts with “abc” followed by two digit month and two digit year. Is there a way to grab the month and year from each filename and append it to the end of each line. Once this is done I want to combine all the files into file... (1 Reply)
Discussion started by: rkumar28
1 Replies

2. Shell Programming and Scripting

How to add filename to the end of each line in file

Hi, I'm reading data from comma separated files to DB. Now there is a need to have the name of the input file in each row of that file. How can I do this in unix script? Example: $cat file1 value11,value12, value,13 value21,value22, value,23 value31,value32, value,33 And the result... (2 Replies)
Discussion started by: tmikahan
2 Replies

3. Shell Programming and Scripting

tar: extract single file to different filepath

Hi, This is my first post here - I'm hoping I can get some help! I have searched these forums and othersand not getting anything that works. I am trying to extract a single file from a tar archive to a diffierent location than it will default to. For example my tar log shows me ... a... (3 Replies)
Discussion started by: littleIdiot
3 Replies

4. Shell Programming and Scripting

Grab a number at end of filepath

Hello, I have a file path such as: /path/to/whatever/30 and I want to get the number off the end. My problem is that there might be other numbers in the path and the last number can be 1 or 2 digits. I tried something like: sed 's/.*\(\/\{1,2\}\).*/\1/' which seems to work fine for single digit... (7 Replies)
Discussion started by: phreezr
7 Replies

5. UNIX for Dummies Questions & Answers

How to copy/move to a file with a special character as the 1st char in the filename?

I am trying to create files with special characters in its filenames for testing purposes. This is on a Linux RHEL4 but this should also be applicable on a Unix shell. I am able to create files with special characters in the filenames...e.g. cp -pv foo.gif \*special.gif cp -pv foo.gif \... (6 Replies)
Discussion started by: sqa777
6 Replies

6. Shell Programming and Scripting

Copy a file with backslash in the filename

Hi, I'm trying to make a script that copy a file that has a backslash in the filename. What I'm doing wrong? The flename is: 1300212744.H786972P30819.ns1.cybernet.com.br,S\=6313:2, My script ParteA="1300212970.H27173P31627.ns1.cybernet.com.br,S" ParteB=\\ ParteC="=" ParteZ=":2,"... (15 Replies)
Discussion started by: Ronaldo
15 Replies

7. Shell Programming and Scripting

How to add filepath to filename when moving it?

Hi I have a cron job setup that searches for 'core dump' files in a fixed set of directories and moves the core files to a separate file system. I am able to add date and time info to the file name. How can I add the source directory path to the file name? In case anyone is wondering why I... (5 Replies)
Discussion started by: dexter126
5 Replies

8. Shell Programming and Scripting

* in end of filename

Hi, i have some files which looks like given below: -rwxrwxrwx 1 amsbatch ams 1608 Oct 22 2009 AMS_BATCH_COMPILE* -rwxr----- 1 amsbatch ams 1608 Oct 22 2009 AMS_BATCH_COMPILE_original* -rwxrwxrwx 1 amsbatch ams 1127 Dec 1 2005 AMS_LMU.sh* drwxr-xr-x 2... (3 Replies)
Discussion started by: mann2719
3 Replies

9. Shell Programming and Scripting

Copy contain file to end another file

Hi All, How I can paste contain big file1 to end another file2, e.g., $cat file1 aaaaa bbbbb ccccc$cat file2 11111 22222 3333 4444 55555 66666 7777 8888then want like paste contain file1 to end file2 > file3 $cat file3 aaaaa bbbbb ccccc 11111 22222 3333 4444 55555 66666... (4 Replies)
Discussion started by: aav1307
4 Replies

10. UNIX for Beginners Questions & Answers

Sha256 , copy file to new filename

Hello, i want to create a sha256 hash for a file and copy the source file under new filename as : sha256hash_sourcefilename Input : sha256sum FILE Example : sha156sum mounttest.123 Output HASH_FILE How to do this ? e.g.: ... (1 Reply)
Discussion started by: bdittmar
1 Replies
dos2unix(1)						      General Commands Manual						       dos2unix(1)

NAME
dos2unix - DOS/MAC to UNIX text file format converter SYNOPSYS
dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...] Options: [-hkqV] [--help] [--keepdate] [--quiet] [--version] DESCRIPTION
This manual page documents dos2unix, the program that converts plain text files in DOS/MAC format to UNIX format. OPTIONS
The following options are available: -h --help Print online help. -k --keepdate Keep the date stamp of output file same as input file. -q --quiet Quiet mode. Suppress all warning and messages. -V --version Prints version information. -c --convmode convmode Sets conversion mode. Simulates dos2unix under SunOS. -o --oldfile file ... Old file mode. Convert the file and write output to it. The program default to run in this mode. Wildcard names may be used. -n --newfile infile outfile ... New file mode. Convert the infile and write output to outfile. File names must be given in pairs and wildcard names should NOT be used or you WILL lost your files. EXAMPLES
Get input from stdin and write output to stdout. dos2unix Convert and replace a.txt. Convert and replace b.txt. dos2unix a.txt b.txt dos2unix -o a.txt b.txt Convert and replace a.txt in ASCII conversion mode. Convert and replace b.txt in ISO conversion mode. Convert c.txt from Mac to Unix ascii format. dos2unix a.txt -c iso b.txt dos2unix -c ascii a.txt -c iso b.txt dos2unix -c mac a.txt b.txt Convert and replace a.txt while keeping original date stamp. dos2unix -k a.txt dos2unix -k -o a.txt Convert a.txt and write to e.txt. dos2unix -n a.txt e.txt Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt. dos2unix -k -n a.txt e.txt Convert and replace a.txt. Convert b.txt and write to e.txt. dos2unix a.txt -n b.txt e.txt dos2unix -o a.txt -n b.txt e.txt Convert c.txt and write to e.txt. Convert and replace a.txt. Convert and replace b.txt. Convert d.txt and write to f.txt. dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt DIAGNOSTICS
BUGS
The program does not work properly under MSDOS in stdio processing mode. If you know why is that so, please tell me. AUTHORS
Benjamin Lin - <blin@socs.uts.edu.au> Bernd Johannes Wuebben (mac2unix mode) <wuebben@kde.org> MISCELLANY
Tested environment: Linux 1.2.0 with GNU C 2.5.8 SunOS 4.1.3 with GNU C 2.6.3 MS-DOS 6.20 with Borland C++ 4.02 Suggestions and bug reports are welcome. SEE ALSO
unix2dos(1) mac2unix(1) 1995.03.31 dos2unix v3.0 dos2unix(1)
All times are GMT -4. The time now is 06:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy