Sponsored Content
Full Discussion: naming files in awk
Top Forums UNIX for Dummies Questions & Answers naming files in awk Post 302697743 by pamu on Friday 7th of September 2012 09:50:26 AM
Old 09-07-2012
Quote:
Originally Posted by A-V
test =...
creates file equal to the number of files and the lines
pamu --> gives the same error on the .txt
no worries Smilie in earlier stages when I make my file I can save them with no extension
Thanx
Try this.. not able to run with basename(not working on my machine)
Used new code..
Try this,,Smilie

Code:
FILES="data/*"
for X in $FILES
do
    name=${X%.*}   #removes extensions of the file
    name_new=$(echo "$name" | awk -F "/" '{print $NF}')   # removes all the directory path - You can try just with echo for your desired outputs..
    awk -v NM="$name_new"'$0 != ""{ print > NM"-"NR".txt" }' $X 
done

I hope this helps youSmilie

Logging out...Smilie
This User Gave Thanks to pamu For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Controller Naming

Hello all, How does the Solaris identifies the controller subscript ? ( like c0txdxs0 or c1txdxsx ?? ) I have a unix box ( Ultra 30) running with 2.5.1. When I connected an external hard disk to the on-board scsi port, it got identified as c0t1dxsx... (... (1 Reply)
Discussion started by: shibz
1 Replies

2. Programming

Naming a socket

Im not very experienced with C so this is probably a basic question. I have a script that opens up 5 sockets, it then runs through a loop and on a given event reconnects to the relevant socket and sends some data. The socket to be reconnected to is kept track of with a 'count' variable. The sockets... (5 Replies)
Discussion started by: geester
5 Replies

3. UNIX for Dummies Questions & Answers

naming files that csplit creates

Hi, This is my first time on this forum.. I searched the previous answers, but didn't find the answer I was looking for at first glance. csplit works beautifully for me, except for one thing. My file looks like this: ad|name1|asdf...(several pages)..asdf ... ad|name2|asdf...(several... (8 Replies)
Discussion started by: juliette salexa
8 Replies

4. Shell Programming and Scripting

#file naming

hi all, Please advise at what circumstance those file will become -rwxr-xr-x 1 psa psa 1969088 Aug 18 2006 #libaa.sl -rwx------ 1 psa psa 2166784 Jul 25 2006 #libcrypto.sl.0.9.7 -rwx------ 1 psa psa 904040 Jul 25 2006 #libxxx.sl -rwx------ 1 psa ... (2 Replies)
Discussion started by: rauphelhunter
2 Replies

5. Shell Programming and Scripting

Complex overlap and naming of 2 input files - Awk

for every specific $1,$2 check the values ($2,$3) of their E ot I of input1 and overlap with input2. Specify names based on output. ####### if middle value is missing name them "SE" if first value is missing name them "AFE" if last value is missing name them "ALE" if 2 middle values are... (1 Reply)
Discussion started by: ruby_sgp
1 Replies

6. Shell Programming and Scripting

Concatenate files to one file with naming convention

Hi , i have below files in wrk folder. file names are 1102090001.CLT 1102090003.CLT 1102100019.CLT 1102100020.CLT the above files are concatenate to one file but that concatenate file name must be same naming convention. (date +%y%m%d)and 0001 count. example : concatenate file... (9 Replies)
Discussion started by: krbala1985
9 Replies

7. UNIX Desktop Questions & Answers

Combining files with specific patterns of naming in a directory

Greetings Unix exports, I am facing some problems in combining files with different name patterns with a directory and I would appreciate if you can help me I have more than 1000 files but they follow a specific pattern of naming. e.g. 64Xtest01.txt They are divided into two sets of test and... (9 Replies)
Discussion started by: A-V
9 Replies

8. Shell Programming and Scripting

Naming output files based on variable parameters and input filenames

Hello, I have a series of files in sub-directories that I want to loop through, process and name according to the input filename and the various parameters I'm using to process the files. I have a number of each, for example file names like AG005574, AG004788, AG003854 and parameter values like... (2 Replies)
Discussion started by: bdeads
2 Replies

9. Shell Programming and Scripting

Help with naming the file

Hi, I have a folder that contains files abc.txt def.txt ....and so on Inside abc.txt, I have @<TRIPOS>MOLECULE 4|Chelerythrine|abcb11_earlyIdentification_Stronginhib_washed_ligprep|sdf|1|dock Inside def.txt, I have @<TRIPOS>MOLECULE... (6 Replies)
Discussion started by: rossi
6 Replies

10. Shell Programming and Scripting

Concatenation of files with same naming patterns dynamically

Since my last threads were closed on account of spamming, keeping just this one opened! Hi, I have the following reports that get generated every 1 hour and this is my requirement: 1. 5 reports get generated every hour with the names "Report.Dddmmyy.Thhmiss.CTLR"... (5 Replies)
Discussion started by: Jesshelle David
5 Replies
ad(5)							Standards, Environments, and Macros						     ad(5)

NAME
ad - Active Directory as a naming repository DESCRIPTION
Solaris clients can obtain naming information from Active Directory (AD) servers. The Solaris system must first join an AD domain and then add the ad keyword to the appropriate entries in the nsswitch.conf(4) file. The Solaris system joins the AD domain by using the kclient(1M) utility. The AD name service only supports the naming databases for passwd and group. Windows users are not able to log in. The user_attr(4) database has no entries for Windows users, and the passwd(1) command does not sup- port the synchronization of user passwords with AD. The Solaris AD client uses auto-discovery techniques to find AD directory servers, such as domain controllers and global catalog servers. The client also uses the LDAP v3 protocol to access naming information from AD servers. The AD server schema requires no modification because the AD client works with native AD schema. The Solaris AD client uses the idmap(1M) service to map between Windows security identi- fiers (SIDs) and Solaris user identifiers (UIDs) and group identifiers (GIDs). User names and group names are taken from the sAMAccountName attribute of the AD user and group objects and then tagged with the domain where the objects reside. The domain name is separated from the user name or group name by the @ character. The client uses the SASL/GSSAPI/KRB5 security model. The kclient utility is used to join the client to AD. During the join operation, kclient configures Kerberos v5 on the client. See kclient(1M). FILES
/etc/nsswitch.conf Configuration file for the name-service switch. /etc/nsswitch.ad Sample configuration file for the name-service switch configured with ad, dns and files. /usr/lib/nss_ad.so.1 Name service switch module for AD. SEE ALSO
passwd(1), svcs(1), idmap(1M), idmapd(1M), kclient(1M), svcadm(1M), svccfg(1M), svccfg(1M), nsswitch.conf(4), user_attr(4), smf(5) SunOS 5.11 22 Oct 2008 ad(5)
All times are GMT -4. The time now is 06:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy